Re: Sequential Scan with LIMIT

Поиск
Список
Период
Сортировка
От Jim C. Nasby
Тема Re: Sequential Scan with LIMIT
Дата
Msg-id 20041028234658.GI55164@decibel.org
обсуждение исходный текст
Ответ на Re: Sequential Scan with LIMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Sequential Scan with LIMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
On Sun, Oct 24, 2004 at 04:11:53PM -0400, Tom Lane wrote:
> But the LIMIT will cut the cost of the seqscan case too.  Given the
> numbers you posit above, about one row in five will have 'myval', so a
> seqscan can reasonably expect to hit the first matching row in the first
> page of the table.  This is still cheaper than doing an index scan
> (which must require reading at least one index page plus at least one
> table page).
>
> The test case you are showing is probably suffering from nonrandom
> placement of this particular data value; which is something that the
> statistics we keep are too crude to detect.

Isn't that exactly what pg_stats.correlation is?
--
Jim C. Nasby, Database Consultant               decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance Anomalies in 7.4.5
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Sequential Scan with LIMIT