Re: Postgres optimizer choosing wrong index

From: Jack Orenstein <jack(dot)orenstein(at)hds(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres optimizer choosing wrong index
Date: 2008-10-23 17:27:15
Message-ID: 4900B3F3.5000101@hds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Jack Orenstein <jack(dot)orenstein(at)hds(dot)com> writes:
>> Tom Lane wrote:
>>> If you plug in a value that *does* occur in the table it should probably
>>> choose the more-relevant index consistently.
>
>> Unfortunately, it matters a lot at runtime. The dh value is not very selective,
>> as shown by the statistics above.
>
> A dh value that does not occur in the index is *perfectly* selective.
> I'm not sure what your problem is but this example isn't illustrating
> anything wrong that I can see.

I see your point.

I may have simplified too far. Our application runs a number of different
queries. All our WHERE clauses restrict dh and fh. For a given pair of (dh, fh)
values, the initial query should come up empty and then insert this pair, and
then there is further processing (SELECT, UPDATE). Something is causing a huge
number of index row reads (according to pg_stat_user_indexes) but only in tables
that have been vacuumed.

Jack

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2008-10-23 17:29:28 Re: Import db from 8.1.3 to 8.3.1
Previous Message Collin Kidder 2008-10-23 17:25:47 Re: Annoying Reply-To