Re: [HACKERS] indexes and floats
От | Brook Milligan |
---|---|
Тема | Re: [HACKERS] indexes and floats |
Дата | |
Msg-id | 199808061842.MAA02106@trillium.nmsu.edu обсуждение исходный текст |
Ответ на | Re: [HACKERS] indexes and floats (Bruce Momjian <maillist@candle.pha.pa.us>) |
Ответы |
Re: [HACKERS] indexes and floats
|
Список | pgsql-hackers |
> Sorry, but maybe it would be better to add new attribute > to pg_proc (and change CREATE FUNCTION syntax) to let > parser know does result of function call on constants depend > on execution time or not. This would be much better just > execute function in parser and replace function with > constant. > Currently, only random(), now() and SPI-functions should be > replaced by PARAM_EXEC, all others could be evaluated by parser. I see. We have pg_proc.proiscachable. This looks like a good candidate, and is not used for anything currently. Maybe rename it to something clearer. Wouldn't the concept of VOLATILE be relevant here (ala the same keyword in C and C++)? In those languages the keyword influences the nature of optimizations that can be done, which seems to be the problems involved here. We could have a function bool pg_proc.is_volatile() to determine whether or not the result of the function call can be determined from its arguments. If so and the arguments are constants, the function could be evaluated once in the parser; otherwise, it would need to be evaluated for each tuple. The current situation, I presume, corresponds with all functions being VOLATILE and hence evaluated many times. We could 1) add new syntax for declaring user-defined functions to optionally include VOLATILE (and/or NONVOLATILE; default being VOLATILE in the absense of a keyword to maintain compatibility and to be safe), 2) have the is_volatile() function return appropriate values for all "standard" functions defined in the system, and 3) include handling of the distinction in the parser. Cheers, Brook
В списке pgsql-hackers по дате отправления: