Making proiscachable believable
От | Tom Lane |
---|---|
Тема | Making proiscachable believable |
Дата | |
Msg-id | 17171.938308362@sss.pgh.pa.us обсуждение исходный текст |
Список | pgsql-hackers |
I am just about to commit Bernard Frankpitt's constant-expression-reducing code, along with some of the improvements I suggested a couple days ago. In particular, it will not try to reduce any op/func not marked "proiscachable" in pg_proc. This renders it a tad ineffective with the current contents of pg_proc :-( ... The only functions marked cachable in 6.5.2 are play=> select proname from pg_proc where proiscachable; proname --------- version hashsel hashnpage gistsel gistnpage (5 rows) and to add insult to injury, I believe all five of these markings are wrong! Functions whose outputs can vary for the same inputs must not be marked cacheable --- and all of these use data other than their arguments. I have been working on modifying pg_proc.h to have believable cacheability information. What I did was to mark everything cacheable and then go through and unmark the stuff that shouldn't be constant-foldable: basically, stuff that fetches data from tables, stuff that involves datetime conversion, and a few special cases like nextval() and oidrand(). I am worried that I may have missed some things, and am seeking advice on how I can check my work. One thing I did not realize at first was that *none* of the datetime, date, abstime, timespan, or tinterval operators can safely be marked cachable. The reason: these datatypes have special data values that mean "now" (this has nothing to do with what the conversion to/from text form yields, BTW). Thus, for example, datetimeeq might say one thing today and another tomorrow for the same input values, if one of them is "now" and the other is a constant time. Short of inserting knowledge about these special values into the constant- folder, we have to mark all the operations on the datatype non-foldable. Are there any other gotchas like that one? regards, tom lane
В списке pgsql-hackers по дате отправления: