Re: Problem with index not being chosen inside PL/PgSQL function...
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Problem with index not being chosen inside PL/PgSQL function... |
| Дата | |
| Msg-id | 835.1197995766@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Problem with index not being chosen inside PL/PgSQL function... ("Weber, Geoffrey M." <Geoffrey.Weber@mcleodusa.com>) |
| Ответы |
Re: Problem with index not being chosen inside PL/PgSQL
function...
|
| Список | pgsql-general |
"Weber, Geoffrey M." <Geoffrey.Weber@mcleodusa.com> writes:
> Hmm - good question! However, it is - both the id and
> not_displayed_id are INTEGERs.
Well, in that case it must be a statistics issue --- does the indexed
column have a badly skewed distribution?
You could investigate how many rows the planner thinks will be fetched
via
PREPARE foo(int) AS
SELECT ah.* FROM alert ah where ( (ah.replaced_by_id = '0') AND (not_displayed_id = $1 ) ) ORDER BY replaced_by_id,
not_displayed_id;
EXPLAIN EXECUTE foo(42);
which will set up exactly the same planning situation as occurs in the
plpgsql function: no knowledge of the exact value being compared to.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера