pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Eric Jiang <eric@doublemap.com>
Cc: pgsql-performance@postgresql.org, Eric Clark <eclark@doublemap.com>
Subject: Re: Querying with multicolumn index
Date: Sat, 10 Dec 2016 19:51:33 -0500
Message-ID: <14793.1481417493@sss.pgh.pa.us> (raw)
In-Reply-To: <b92cec0d-c4b2-5e44-a6b9-949d2b93e935@2ndquadrant.com>
References: <CAOfJSTwzQ7Fx6Yjeg9mFkMsM5OVKPoa=EgkHceGdkr1TWg8vkA@mail.gmail.com>
	<5353.1481327501@sss.pgh.pa.us>
	<b92cec0d-c4b2-5e44-a6b9-949d2b93e935@2ndquadrant.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On 12/10/2016 12:51 AM, Tom Lane wrote:
>> I tried to duplicate this behavior, without success.  Are you running
>> with nondefault planner parameters?

> My guess is this is a case of LIMIT the matching rows are uniformly 
> distributed in the input data. The planner likely concludes that for a 
> driver with a lot of data we'll find the first row using ix_updates_time 
> very quickly, and that it will be cheaper than inspecting the larger 
> multi-column index. But imagine a driver with a lots of data long time 
> ago. That breaks the LIMIT fairly quickly.

The fact that it's slow enough to be a problem is doubtless related to
that effect.  But AFAICS, the planner should never prefer that index
for this query, because even with a uniform-density assumption, the
index that really matches the query ought to look better.

			regards, tom lane


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (12+ messages)  latest in thread

Message-ID: <14793.1481417493@sss.pgh.pa.us>
Permalink:  ../14793.1481417493@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14793.1481417493@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tomas.vondra@2ndquadrant.com, eric@doublemap.com, eclark@doublemap.com
  Subject: Re: Querying with multicolumn index
  In-Reply-To: <14793.1481417493@sss.pgh.pa.us>

* 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