| От | Tom Lane |
|---|---|
| Тема | Re: Seq scan vs index scan |
| Дата | |
| Msg-id | 1242761.1711167196@sss.pgh.pa.us обсуждение |
| Ответ на | Seq scan vs index scan (arun chirappurath <arunsnmimt@gmail.com>) |
| Список | pgsql-general |
arun chirappurath <arunsnmimt@gmail.com> writes:
> I have a table named users with index on user name.
> ...
> When I try to do below select query it's taking seq scan and query returns
> in 5ms.
5ms is an okay runtime, I would think. Is the table empty?
> I am trying to force query to use indexes using query hints.
The way to force it would be enable_seqscan = off. I would not
be surprised to hear that that makes it slower, though. The
planner will prefer not to use an index if it thinks that will
be slower, and in this case it sounds like that could be right.
(Don't ever assume that what the planner does with a small table
is what it will do with a large table.)
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера