Does it make sense to break a large query into separate functions?

Поиск
Список
Период
Сортировка
От Seref Arikan
Тема Does it make sense to break a large query into separate functions?
Дата
Msg-id CA+4ThdpgXT7Hx1V52uLyCoNKY5dTA5aAQMRsqZE7_zJeQ=uOGg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Does it make sense to break a large query into separate functions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Does it make sense to break a large query into separate functions?  (Julian <tempura@internode.on.net>)
Список pgsql-general
Greetings, 

I have a domain specific language implementation that ends up as sql after an automatic transformation/code generation phase. 
The complexity of the generated sql queries can be significant, with lots of self joins and many other criteria injected into sql. 

I've just noticed that some parts of the autogenerated queries can be functions on their own. Would moving these parts to their own functions help the query planner? 

There are any two tables and all queries use them, so I thought the query planner may be able to do better if I let it deal with smaller queries rather than one quite large one. I don't know how the query planner works when there are calls to other functions from a function though.

Changing the code generator would take time, so I decided to ask for more educated input than mine.

Best regards
Seref

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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: PAM implementation in PG 9.2.3
Следующее
От: Tyson Maly
Дата:
Сообщение: question on most efficient way to increment a column