Performance of a query
От | Edmund Dengler |
---|---|
Тема | Performance of a query |
Дата | |
Msg-id | Pine.BSO.4.44.0306112004030.149-100000@cyclops4.esentire.com обсуждение исходный текст |
Ответы |
Re: Performance of a query
|
Список | pgsql-general |
Greetings all! So I have had a look at the documentation to see what options I have in separating the "select now() - '2 hours'::interval" from the rest of my query. As far as I can tell, I have the following options: (1) Do it in my calling code (Perl). Create two statements, execute the first to get the time interval, then the second to get the results. (2) Create a custom function that will enable me to have a variable. This is now feasible with SETOF. Any issues with size of result set that would be any different than if I do it directly? (3) Use a temporary table. Ugly if the statement appears more than once in the complex expression. Not sure if the constant folding would work without some experimentation. Performance hits with creating temporary tables? (4) Use code to generate the time in my calling code, and then execute the one statement. Would probably work, but I would need to see if all my cases fall into this strategy. Overall, none of them are appealing. Doesn't look like I have the option of using PL/pgSQL without going through the whole process of creating a function (which is possible in Oracle, as far as I can recall). Any other appraches or recommended coding methods? Regards, Ed
В списке pgsql-general по дате отправления: