Re: Index only scan sometimes switches to sequential scan for small amount of rows - Mailing list pgsql-performance

From Tom Lane
Subject Re: Index only scan sometimes switches to sequential scan for small amount of rows
Date
Msg-id 7439.1427304380@sss.pgh.pa.us
Whole thread Raw
In response to Re: Index only scan sometimes switches to sequential scan for small amount of rows  (Feike Steenbergen <feikesteenbergen@gmail.com>)
Responses Re: Index only scan sometimes switches to sequential scan for small amount of rows  (Feike Steenbergen <feikesteenbergen@gmail.com>)
List pgsql-performance
Feike Steenbergen <feikesteenbergen@gmail.com> writes:
> On 25 March 2015 at 13:45, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>>> We can also increase the 'Stats target' for this table, which will
>>> cause the statistics to contain information about 'NOT_YET_PRINTED'
>>> more often, but even then, it may not find any of these records, as
>>> they sometimes do not exist.

>> This is a better solution, IMHO.

> We'll have a go at this, also if what you say about values having to
> appear at least twice, the other values may make it into
> most_common_*, which would make it clearer to us.

In principle increasing the stats target should fix this, whether or not
'NOT_YET_PRINTED' appears in the MCV list after any particular analyze;
because what will happen is that the frequency for 'PRINTED' will more
nearly approach 1, and so the estimated selectivity for other values
will drop even if they're not in the list.

            regards, tom lane


pgsql-performance by date:

Previous
From: Feike Steenbergen
Date:
Subject: Re: Index only scan sometimes switches to sequential scan for small amount of rows
Next
From: Jeff Janes
Date:
Subject: Re: Index only scan sometimes switches to sequential scan for small amount of rows