Unix Technical Forum

Select * query extremely slow only for some records on small,simple table - why?

This is a discussion on Select * query extremely slow only for some records on small,simple table - why? within the Pgsql Performance forums, part of the PostgreSQL category; --> Hi there, I have a small, simple table of about a dozen columns, that contains less than 100 records. ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 11:41 AM
Elmar Schraml
 
Posts: n/a
Default Select * query extremely slow only for some records on small,simple table - why?

Hi there,

I have a small, simple table of about a dozen columns, that contains
less than 100 records.
Primary key is a serial id, there's a few small strings, numbers and
dates, and a foreign key (another serial int)

Usually, a select * from tablename where owner_id = <id>; takes a
negligible amount of time.
However, under certain conditions/querying certain records the query
takes more than 40 seconds!
Those records are no different that the ones for which the query is
fast.

I have absolutely no idea what could cause a simple select on a small
table to take that long - any pointers?

Examples of things I've tried:
- Select * from items where owner_id = 1; -> fast
- Select * from items where owner_id = 7; -> very slow (40 seconds),
owner with id of 7 is no different from others
- Select * from items where owner_id = 7 and id > 0;
-> dummy conditions makes it fast again, but I 'm using an O/R-
framework, so i can't add the dummy condition manually

It happens only on the production server, on a similar testing server
as well as my local development machine it works fine. Postgres
version on the production machine is 8.1.9 running on CentOS linux.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com