Re: Set query_id for query contained in utility statement - Mailing list pgsql-hackers

From jian he
Subject Re: Set query_id for query contained in utility statement
Date
Msg-id CACJufxGQSpJwa4tDOx5pDy3879=-2sqHEFeWD5_a8DcCaJYuXA@mail.gmail.com
Whole thread Raw
In response to Set query_id for query contained in utility statement  (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>)
Responses Re: Set query_id for query contained in utility statement
List pgsql-hackers
PREPARE test_prepare_pgss1(int, int) AS select generate_series($1, $2);
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
EXECUTE test_prepare_pgss1 (1,2);
EXECUTE test_prepare_pgss1 (1,3);
SELECT toplevel, calls, query, queryid, rows FROM pg_stat_statements
ORDER BY query COLLATE "C", toplevel;
SELECT pg_stat_statements_reset() IS NOT NULL AS t;

---the above works just fine. just for demo purpose

explain(verbose) EXECUTE test_prepare_pgss1(1, 2);
explain(verbose) EXECUTE test_prepare_pgss1(1, 3);


SELECT toplevel, calls, query, queryid, rows FROM pg_stat_statements
ORDER BY query COLLATE "C", toplevel;
 toplevel | calls |                                 query
                    |       queryid        | rows

----------+-------+------------------------------------------------------------------------+----------------------+------
 f        |     2 | PREPARE test_prepare_pgss1(int, int) AS select
generate_series($1, $2) | -3421048434214482065 |    0
 t        |     1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
                    |  3366652201587963567 |    1
 t        |     0 | SELECT toplevel, calls, query, queryid, rows FROM
pg_stat_statements  +| -6410939316132384446 |    0
          |       | ORDER BY query COLLATE "C", toplevel
                    |                      |
 t        |     1 | explain(verbose) EXECUTE test_prepare_pgss1(1, 2)
                    |  7618807962395633001 |    0
 t        |     1 | explain(verbose) EXECUTE test_prepare_pgss1(1, 3)
                    | -2281958002956676857 |    0

Is it possible to normalize top level utilities explain query, make
these two have the same queryid?
explain(verbose) EXECUTE test_prepare_pgss1(1, 2);
explain(verbose) EXECUTE test_prepare_pgss1(1, 3);


I guess this is a corner case.



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: general purpose array_sort
Next
From: Tom Lane
Date:
Subject: Re: pg_verifybackup: TAR format backup verification