"Francisco Reyes" <lists@xxxxxxxxxxxxxxxx> writes: > On 3:37 pm 07/23/08 Tom Lane <tgl@xxxxxxxxxxxxx> wrote: >> You might be more likely to get a sane plan if you had an index on >> join_ids.customer_id. > There is an index in join_ids: > joinids_customerids_joinid" btree (customer_id, joinid) WITH (fillfactor=98) [ squint... ] That makes no sense at all; it should certainly have picked that index and not join_ids_join_id for a scan with a condition on customer_id. What is the datatype of the customer_id column exactly? (Actually, if you could show us the whole schema of both these tables, such as their psql \d descriptions, that would be helpful.) regards, tom lane