Mario Splivalo <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq