Re: strange index behaviour with different statistics target

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: strange index behaviour with different statistics target
Date: 2009-01-13 23:06:01
Message-ID: 3043.1231887961@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jeff Frost <jeff(at)frostconsultingllc(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Frost 2009-01-13 23:23:08 Re: strange index behaviour with different statistics target
Previous Message Jeff Frost 2009-01-13 22:34:42 strange index behaviour with different statistics target