Re: Wrong plan sequential scan instead of an index one

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Wrong plan sequential scan instead of an index one
Дата
Msg-id 460CE775.8080908@archonet.com
обсуждение исходный текст
Ответ на Re: Wrong plan sequential scan instead of an index one  (Gaetano Mendola <mendola@bigfoot.com>)
Список pgsql-performance
Gaetano Mendola wrote:
>
> Richard Huxton wrote:
>>
>> Now, why 19 rows from the subquery should produce such a large estimate
>> in the outer query I'm not sure. Any strange distribution of values on
>> pvcp?
>
> I don't know what do you mean for strange, this is the distribution:
>
> test=# select count(*) from t_oa_2_00_card;
>  count
> - --------
>  877682
> (1 row)
>
> test=# select count(*), pvcp from t_oa_2_00_card group by pvcp;
>  count | pvcp
> - -------+------
> (92 rows)
>
>
> I think that estimate is something like:  877682 / 92 * 19

So if you actually had 19 matches for '%pi%' it might be a sensible plan
then. I'm afraid I don't know of any way to improve PG's prediction on
how many matches you'll get for a substring pattern though.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Gaetano Mendola
Дата:
Сообщение: Re: Wrong plan sequential scan instead of an index one
Следующее
От: ismo.tuononen@solenovo.fi
Дата:
Сообщение: Re: Wrong plan sequential scan instead of an index one