From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Puzzling planner choice (non-urgent) |
Date: | 2002-08-05 14:28:41 |
Message-ID: | 20718.1028557721@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Huxton <dev(at)archonet(dot)com> writes:
> What I don't understand is the seq-scan on companies.co_id since it has a
> unique index on it and *can't* match more than once for a given row while
> looping through orders.
Since the table is evidently only 2 pages long, the planner figures it's
cheaper to read it all than to touch both the index and the table.
The hole in this logic is that the cost estimate is made without regard
for the fact that we're scanning the table repeatedly, and so at least
the first few levels of index are likely to stay swapped in. I have
some ideas about how to improve that, but dunno if it'll get done for
7.3. In the meantime you might try reducing random_page_cost to see if
you like the results better.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-08-05 14:31:51 | Re: Update and foreign key indices |
Previous Message | Tom Lane | 2002-08-05 14:20:27 | Re: O'Reilly Open Source Convention Report |