Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)ca> writes:
> The table has 19867 records, and this query takes over 20 minutes. When I
> export the data to a new DB, with the same table (no indexes) it takes
> about 3 seconds.
It kinda sounds like you've done a whole lot of updating and never
vacuumed this table. What does 'VACUUM FULL VERBOSE ind' tell you?
> Any ideas? Would *removing* indexes make it faster?
Yes, but I doubt that it's the indexes that are the bulk of the problem.
regards, tom lane