Re: How does the planner deal with multiple possible indexes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Gregory Maxwell <gmaxwell(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: How does the planner deal with multiple possible indexes?
Date: 2006-07-19 23:54:49
Message-ID: 17149.1153353289@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> Indeed, if I find a case where there's a large enough number of rows it
> will choose the smaller index. But I'm wondering if it would be better
> to always favor the smaller index, since it would (presumably) be easier
> to keep it in cache?

AFAICS, in existing releases that should happen, because the cost
estimate varies with the size of the index. And it does happen for me
in simple tests. You did not provide the requested information to help
us find out why it's not happening for you.

(I'm a bit worried about whether CVS HEAD may have broken this behavior
with the recent changes in the indexscan cost equations ... but unless
you are working with HEAD that's not relevant.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-07-20 00:11:26 Re: Resurrecting per-page cleaner for btree
Previous Message Tom Lane 2006-07-19 23:45:24 Re: Freezing tuples on pages dirtied by vacuum