Re: Slow query - SELECTing one row from 'big' table.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Slow query - SELECTing one row from 'big' table.
Дата
Msg-id 22145.1131031055@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Slow query - SELECTing one row from 'big' table.  (Mario Splivalo <mario.splivalo@mobart.hr>)
Список pgsql-sql
Mario Splivalo <mario.splivalo@mobart.hr> writes:
>          SELECT *
>          FROM messages
>          WHERE (id = currval(''public.message_id_seq''::text))

That cannot legally be converted into an indexscan, because currval() is
a volatile function --- the planner cannot be certain that its value
won't change during the query.  (In this case we can assume it's safe
because nothing in that query would call nextval(), but the planner
isn't omniscient enough to make that conclusion.)

Fetch the currval into a local variable and use the variable in the
query.
        regards, tom lane


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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Welcome to the pgsql-sql list!
Следующее
От: Don Drake
Дата:
Сообщение: Encoding on 8.0.4