Re: surprising query optimisation - Mailing list pgsql-general

From Chris Withers
Subject Re: surprising query optimisation
Date
Msg-id 076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org
Whole thread Raw
In response to Re: surprising query optimisation  (Stephen Frost <sfrost@snowman.net>)
Responses Re: surprising query optimisation
List pgsql-general
On 30/11/2018 12:55, Stephen Frost wrote:
>      > I'd suggest you check out the wiki article written about this kind of
>      > question:
>      >
>      > https://wiki.postgresql.org/wiki/Slow_Query_Questions
> 
> 
> Have you tried a partial index on state!=‘RSV’?

The solution I originally posted, that we do easily enough at our query 
generation layer, is working perfectly, but this is good to know for 
next time.

My post here is mainly to try and understand what's going on so I can 
improve my general feel for how to use postgres at it's best.

So, why was the query ending up being a big scan rather than some quick 
lookups based on the index?

cheers,

Chris


pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: surprising query optimisation
Next
From: Stephen Frost
Date:
Subject: Re: surprising query optimisation