Adam Witney <awitney@xxxxxxxxxx> writes: > bugasbase2=# SELECT bioassay_id, count(*) from mba_data_base where > bioassay_id = 5153 group by bioassay_id; > bioassay_id | count > -------------+------- > 5153 | 20000 > 9712 | 120 That's pretty interesting :-(. What PG version is this? Is there an index on bioassay_id, and if so is the query using it? REINDEXing the index might fix it. regards, tom lane