Planner hints in SELECT queries?
От
Dmitry Koterov
Тема
Planner hints in SELECT queries?
Дата
Msg-id
d7df81620812170630t70d0117fka7866892f01435d4@mail.gmail.com
Список
Дерево обсуждения
Planner hints in SELECT queries? "Dmitry Koterov" <dmitry@koterov.ru>
Re: Planner hints in SELECT queries? Tom Lane <tgl@sss.pgh.pa.us>
Hello.
Sometimes I have to create the following SQL code:
SET something=off;
SET other=off;
SELECT * FROM ... ORDER BY id LIMIT 10;
RESET something;
RESET something;
(e.g. "something" may be equal to "seq_page_cost=100000").
I propose to add the SELECT clause to do it natively, like this:
SELECT *
FROM tbl
ORDER BY id
LIMIT 10
SETTING something=off, other=off
This will do RESET back automatically when the query is executed.
(Why do I need it? Because sometimes even after ANALYZE query I get non-optimal plan, even if I exactly know which plan should be used.)
Sometimes I have to create the following SQL code:
SET something=off;
SET other=off;
SELECT * FROM ... ORDER BY id LIMIT 10;
RESET something;
RESET something;
(e.g. "something" may be equal to "seq_page_cost=100000").
I propose to add the SELECT clause to do it natively, like this:
SELECT *
FROM tbl
ORDER BY id
LIMIT 10
SETTING something=off, other=off
This will do RESET back automatically when the query is executed.
(Why do I need it? Because sometimes even after ANALYZE query I get non-optimal plan, even if I exactly know which plan should be used.)
В списке pgsql-general по дате отправления