Re: Optimizing No matching record Queries

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Optimizing No matching record Queries
Дата
Msg-id 47B2B058.7020804@archonet.com
обсуждение исходный текст
Ответ на Re: Optimizing No matching record Queries  ("Dean Gibson (DB Administrator)" <postgresql@ultimeth.com>)
Ответы Re: Optimizing No matching record Queries
Список pgsql-performance
Dean Gibson (DB Administrator) wrote:
> The questions are:
>
> 1. Why in the planner scanning the entire idx_listing_entrydate, when
> I'd think it should be scanning the entire
> pk_listingstatus_listingstatusid ?

It's looking at the ORDER BY and sees that the query needs the 10 most
recent, so tries searching by date. That's sensible where you are going
to have a lot of matches for fklistingsourceid.

Which suggests that statistics for "fklistingsourceid" aren't high
enough, like Greg suggested. If that doesn't help, the index on
(fklistingsourceid,entrydate) that Stephen might well do so.

> 2. Why is "Index Scan using pk_listingstatus_listingstatusid on
> listingstatus listingsta1_  (cost=0.00..0.27 rows=1 width=4) (never
> executed)" ?

Because nothing comes out of the first index-scan.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Optimizing No matching record Queries
Следующее
От: Tore Halset
Дата:
Сообщение: Re: Dell Perc/6