Re: strange index behaviour with different statistics target - Mailing list pgsql-performance

From Tom Lane
Subject Re: strange index behaviour with different statistics target
Date
Msg-id 3043.1231887961@sss.pgh.pa.us
Whole thread Raw
In response to strange index behaviour with different statistics target  (Jeff Frost <jeff@frostconsultingllc.com>)
Responses Re: strange index behaviour with different statistics target  (Jeff Frost <jeff@frostconsultingllc.com>)
List pgsql-performance
Jeff Frost <jeff@frostconsultingllc.com> writes:
> So, my question is, should changing the stats target on the shape column
> affect the stats for the content_id and content_type columns?

It would change the size of the sample for the table, which might
improve the accuracy of the stats.  IIRC you'd still get the same number
of histogram entries and most-common-values for the other columns, but
they might be more accurate.

> Also, why does the index on content_id win out over the compound index
> on (content_type, content_id)?

It's deciding (apparently correctly, from the explain results) that the
larger index isn't increasing the selectivity enough to be worth its
extra search cost.  I suppose content_type = 'Story' isn't very
selective in this table?

            regards, tom lane

pgsql-performance by date:

Previous
From: Jeff Frost
Date:
Subject: strange index behaviour with different statistics target
Next
From: Jeff Frost
Date:
Subject: Re: strange index behaviour with different statistics target