Re: is this a bug or do I not understand the query planner?
В списке pgsql-bugs по дате отправления:
| От | Qingqing Zhou |
|---|---|
| Тема | Re: is this a bug or do I not understand the query planner? |
| Дата | |
| Msg-id | dke805$18rl$1@news.hub.org обсуждение исходный текст |
| Ответ на | is this a bug or do I not understand the query planner? (Rob Prowel <tempest766@yahoo.com>) |
| Список | pgsql-bugs |
"Rob Prowel" <tempest766@yahoo.com> wrote
> two almost identical queries: one searches for
>
> read in ('N','n')
>
> and the other searches for
>
> read in ('Y','y').
>
> the (explain) SQL statement says that one uses the
> index on the (read) field and the other does a
> sequential table scan. Why!!!????
With big chance, it is not a bug. As your explain indicates, Yy query is
estimated only return 1 row while Nn query is estimated to return 2018135
rows. So for the latter, compared to your table size(I guess), an seqscan is
more suitable.
Try "explain analyze" to see if the query optimizer gets a right guess. If
not, run "vacuum full analyze", then check again. If still not, you may want
to post the results here.
Regards,
Qingqing
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера