Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition

From: Netskin | Corin Langosch <clangosch(at)netskin(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Date: 2010-10-10 10:48:28
Message-ID: 4CB199FC.6070300@netskin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 10.10.2010 05:26, Tom Lane wrote:
> Try it like
>
> WHERE amazon_product_id IS NOT NULL;
>
You are right. When I change the condition on the index like this, the
index gets used as it should. Even without having to specify the extra
not null condition in the query.

> We don't expend an infinite number of cycles on rewriting different
> query formulations into each other, and that's one of the ones we
> don't handle ...
>
The problem is the code is generated by an ORM and so cannot easily be
modified. I can understand that you wont spend the time for each query,
but I think for (normally) very seldom used things like creating new
indices it would be a good enhancement.

Corin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message maizi 2010-10-10 16:54:32 wrong timezone precision using plpythonu trigger
Previous Message Tom Lane 2010-10-10 04:26:51 Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition