Hello, hackers!
Here there's a seventh version of the patch for the precalculation of
stable or immutable functions, stable or immutable operators and other
nonvolatile expressions. It is rebased on the top of master and has some
code cleanup [1]. See attached patch.
About TPC-H tests using dbt3 (see the attached small archieve):
* they were made based on commit
255f14183ac7bc6a83a5bb00d67d5ac7e8b645f1;
* they take some time so I have used only scales 1 and 4;
* 3 attempts are used to eliminate some noise; so you can see the
minimum, median and maximum execution time for each query on the graphs.
About their results:
* as expected, cached expressions were not used in queries;
* it seems that there is no obvious degradation of performance.
Any suggestions are welcome!
[1] Fixed:
>> Also I see this pattern quite some time, maybe it makes sense to move
>> it to a function?
>>
>> ```
>> + /* create and return CachedExpr */
>> + CachedExpr *new_node = makeNode(CachedExpr);
>> + new_node->subexpr = (CacheableExpr *) current_node;
>> +
>> + context->root->hasCachedExpr = true;
>> +
>> + return (Node *) new_node;
>> ```
>
> Thanks, I agree with you and I'll change it accordingly.
--
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company