Re: pg_stat_statements oddity with track = all
Julien Rouhaud <rjuju123@gmail.com>
From: Julien Rouhaud <rjuju123@gmail.com>
To: Sergei Kornilov <sk@zsrv.org>
Cc: legrand legrand <legrand_legrand@hotmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-12-03T08:52:08Z
Lists: pgsql-hackers
On Wed, Dec 02, 2020 at 05:13:56PM +0300, Sergei Kornilov wrote: > Hello > > > - add a parent_statement_id column that would be NULL for top level queries > > Will generate too much entries... Every FK for each different delete/insert, for example. > But very useful for databases with a lot of stored procedures to find where this query is called. May be new mode track = tree? Use NULL to indicate a top-level query (same as with track=tree) and some constant for any nested queries when track = all. Maybe pg_stat_statements isn't the best tool for that use case. For the record the profiler in plpgsql_check can now track queryid for each statements inside a function, so you match pg_stat_statements entries. That's clearly not perfect as dynamic queries could generate different queryid, but that's a start. > Also, currently a top statement will account buffers usage for underlying statements? I think so.
Commits
-
Merge v1.10 of pg_stat_statements into v1.9
- 5844c23dc505 14.0 landed
-
Track identical top vs nested queries independently in pg_stat_statements
- 6b4d23feef6e 14.0 landed