Re: Generating code for query jumbling through gen_node_support.pl

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>, "Drouvot, Bertrand" <bdrouvot@amazon.com>
Date: 2023-01-30T10:39:30Z
Lists: pgsql-hackers

Attachments

On Fri, Jan 27, 2023 at 11:59:47AM +0900, Michael Paquier wrote:
> Using that, I can compile the following results for various cases (-O2
> and compute_query_id=on):
>           query          |  mode  | iterations | avg_runtime_ns | avg_jumble_ns 
> -------------------------+--------+------------+----------------+---------------
>  begin                   | string |   50000000 |        4.53116 |          4.54
>  begin                   | jumble |   50000000 |       30.94578 |         30.94
>  commit                  | string |   50000000 |        4.76004 |          4.74
>  commit                  | jumble |   50000000 |        31.4791 |         31.48
>  create table 1 column   | string |   50000000 |        7.22836 |          7.08
>  create table 1 column   | jumble |   50000000 |      152.10852 |        151.96
>  create table 5 columns  | string |   50000000 |       12.43412 |         12.28
>  create table 5 columns  | jumble |   50000000 |      352.88976 |         349.1
>  create table 20 columns | string |    5000000 |         49.591 |          48.2
>  create table 20 columns | jumble |    5000000 |      2272.4066 |          2271
>  drop table 1 column     | string |   50000000 |        6.70538 |          6.56
>  drop table 1 column     | jumble |   50000000 |          50.38 |         50.24
>  drop table 5 columns    | string |   50000000 |        6.88256 |          6.74
>  drop table 5 columns    | jumble |   50000000 |       50.02898 |          49.9
>  SET work_mem            | string |   50000000 |        7.28752 |          7.28
>  SET work_mem            | jumble |   50000000 |       91.66588 |         91.64
> (16 rows)

Just to close the loop here, I have done more measurements to compare
the jumble done for some DMLs and some SELECTs between HEAD and the
patch (forgot to post some last Friday).  Both methods show comparable
results:
        query         |  mode  | iterations | avg_runtime_ns | avg_jumble_ns 
----------------------+--------+------------+----------------+---------------
 insert table 10 cols | master |   50000000 |      377.17878 |        377.04
 insert table 10 cols | jumble |   50000000 |      409.47924 |        409.34
 insert table 20 cols | master |   50000000 |      692.94924 |         692.8
 insert table 20 cols | jumble |   50000000 |       710.0901 |        709.96
 insert table 5 cols  | master |   50000000 |      232.44308 |         232.3
 insert table 5 cols  | jumble |   50000000 |      253.49854 |        253.36
 select 10 cols       | master |   50000000 |      449.13608 |        383.36
 select 10 cols       | jumble |   50000000 |      491.61912 |        323.86
 select 5 cols        | master |   50000000 |        277.477 |        277.46
 select 5 cols        | jumble |   50000000 |      323.88152 |        323.86
(10 rows)

The averages are in ns, so the difference does not bother me much.
There may be some noise mixed in that ;)

(Attached is the tweak I have applied on HEAD to get some numbers.)
--
Michael

Commits

  1. Mark more nodes with attribute no_query_jumble

  2. Include values of A_Const nodes in query jumbling

  3. Generate code for query jumbling through gen_node_support.pl

  4. Rework format of comments in headers for nodes

  5. Move queryjumble.c code to src/backend/nodes/

  6. Fix some compiler warnings in aset.c and generation.c

  7. Reformat some node comments