Re: Index scan cost calculation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
Cc: Pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index scan cost calculation
Date: 2015-11-26 18:26:27
Message-ID: 6786.1448562387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk> writes:
>> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>> The problem will probably go away by itself as your table grows, but
>> if you don't want to wait, you might want to reflect on which of the index
>> columns might be (partially?) functionally dependent on the other columns,
>> and whether you could redesign the key structure to avoid that.

> Many thanks for the explanation, is such a functional dependency assumed purely based optimistically on statistics gathered by analyze?

Well, the point is that the selectivities associated with the individual
WHERE clauses are assumed independent, which allows us to just multiply
them together. If they're not really independent then multiplication
gives a combined selectivity that's too small. But without cross-column
statistics there's not much we can do to get a better estimate.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2015-11-28 19:25:47 Re: Index scan cost calculation
Previous Message Glyn Astill 2015-11-26 17:50:55 Re: Index scan cost calculation