Re: [HACKERS] WIP Patch: Precalculate stable functions, infrastructure v1

From: Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [HACKERS] WIP Patch: Precalculate stable functions, infrastructure v1
Date: 2018-01-15 13:54:16
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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
* 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:
The Russian Postgres Company

Attachment Content-Type Size
dbt3.tar.gz application/x-gzip 73.5 KB
v7-0001-Precalculate-stable-and-immutable-functions.patch text/plain 428.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-01-15 14:40:57 Re: Implementing SQL ASSERTION
Previous Message Alvaro Herrera 2018-01-15 13:36:04 Re: WIP: a way forward on bootstrap data