Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition - Mailing list pgsql-bugs

From Netskin | Corin Langosch
Subject Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Date
Msg-id 4CB199FC.6070300@netskin.com
Whole thread Raw
In response to Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Next
From: Jeff Davis
Date:
Subject: Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition