Re: Query is 800 times slower when running in function!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query is 800 times slower when running in function!
Дата
Msg-id 6648.1133413080@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Query is 800 times slower when running in function!  (Ralph Mason <ralph.mason@telogis.com>)
Список pgsql-performance
Ralph Mason <ralph.mason@telogis.com> writes:
> I have a simple query that is running inside a plpgsql function.

> SELECT INTO _point_id id FROM ot2.point WHERE unit_id = _unit_id AND
> time > _last_status ORDER BY time LIMIT 1;

It would probably help significantly to make that be
"ORDER BY unit_id, time".  This'd eliminate the need for the separate
sort step and encourage the planner to use the index, even when it does
not know whether the "time > x" condition is selective or not.

            regards, tom lane

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

Предыдущее
От: Ron
Дата:
Сообщение: Re: RES: pg_dump slow
Следующее
От: "Tatsumi Abe"
Дата:
Сообщение: About the relation between fragmentation of file and VACUUM