Re: pg_stat_statements: rows not updated for CREATE TABLE AS SELECT statements
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: legrand legrand <legrand_legrand@hotmail.com>, pgsql-bugs@postgresql.org
Date: 2020-04-20T15:42:48Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- pgss_track_rows_of_utility_v1.patch (text/plain) patch v1
On 2020/03/28 2:43, legrand legrand wrote: > Thank you for those answers ! > >> The utility commands that return CMDTAG_SELECT are >> only CREATE TABLE AS SELECT and CREATE MATERIALIZED VIEW? >> I'd just like to confirm that there is no case where "rows" must not >> be counted when CMDTAG_SELECT is returned. > > I don't have any in mind ... I found that SELECT INTO also returns CMDTAG_SELECT. > >> BTW, "rows" should be updated when FETCH or MOVE is executed >> because each command returns or affects the rows? > > Yes they should, but they aren't yet (event with CMDTAG_SELECT added) > > Note that implicit cursors behave the same way ;o( Thanks for confirming this! Attached is the patch that makes pgss track the total number of rows retrieved or affected by CREATE TABLE AS, SELECT INTO, CREATE MATERIALIZED VIEW and FETCH. I think this is new feature rather than bug fix, so am planning to add this patch into next CommitFest for v14. Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION
Commits
-
pg_stat_statements: track number of rows processed by some utility commands.
- 6023b7ea717c 14.0 landed