pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Withers <chris@withers.org>
To: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: surprising query optimisation
Date: Fri, 30 Nov 2018 13:00:26 +0000
Message-ID: <076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org> (raw)
In-Reply-To: <CAOuzzgpXKJ440Um1-1uEv_HCXU+BFxD7gN8vQBpH1kKXgB8wiA@mail.gmail.com>
References: <03a0af57-3ebc-5501-10ef-6a639c7c34b8@withers.org>
	<20181128224950.GS3415@tamriel.snowman.net>
	<5d7f8d97-32f3-fd88-44cc-948673579a71@withers.org>
	<CAOuzzgpXKJ440Um1-1uEv_HCXU+BFxD7gN8vQBpH1kKXgB8wiA@mail.gmail.com>

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




view thread (19+ messages)  latest in thread

Message-ID: <076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org>
Permalink:  ../076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org/
Also on:    postgresql.org/message-id/076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: chris@withers.org, sfrost@snowman.net
  Subject: Re: surprising query optimisation
  In-Reply-To: <076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org>
  References: <03a0af57-3ebc-5501-10ef-6a639c7c34b8@withers.org> <20181128224950.GS3415@tamriel.snowman.net> <5d7f8d97-32f3-fd88-44cc-948673579a71@withers.org> <CAOuzzgpXKJ440Um1-1uEv_HCXU+BFxD7gN8vQBpH1kKXgB8wiA@mail.gmail.com> <076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox