Re: Incorrect assumptions with low LIMITs

From: Greg Stark <stark(at)mit(dot)edu>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Incorrect assumptions with low LIMITs
Date: 2012-03-17 11:33:45
Message-ID: CAM-w4HNt0ysQOu8NqYK__x0U37jfF4EPHkq4ou26EKODm=9-fA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 17, 2012 at 9:34 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> My wish was to register this as both a common and significant bug,

It has definitely come up here before many times.

However at root the problem is part of the general class of not
understanding how two different columns are related. Postgres is
assuming they're entirely independent and therefore all the values of
x are uniformly distributed over values of y.

To plan this better in your case it would have to know that blah_id <=
72572020 is not equally likely for user_id = ANY
('{....list....}'::integer[]) as it is for the table as a whole.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-03-17 12:48:20 Re: Incorrect assumptions with low LIMITs
Previous Message Simon Riggs 2012-03-17 09:34:41 Re: Incorrect assumptions with low LIMITs