Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added? |
| Дата | |
| Msg-id | 23463.1225137117@sss.pgh.pa.us обсуждение |
| Ответ на | PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added? (Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>) |
| Ответы |
Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT
1 added?
|
| Список | pgsql-general |
Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> writes:
> I'm experiencing a strange issue with PostgreSQL 8.3.3 whereby adding
> "LIMIT 1" to the query increases the query time from several 10s of ms
> to over 5s, and was wondering if anyone with more planner-fu can shed
> some light on this.
It's hoping that the backwards scan will hit a row with the requested
file_id quickly; which might be true on average but isn't true for this
particular file_id (nor, presumably, any file_id that hasn't been
updated recently).
You might consider a two-column index on (file_id, revision_id) to
make this type of query fast.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера