Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSwFd-0000st-St for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Feb 2023 08:37:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSwFc-0003uv-JI for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Feb 2023 08:37:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSwFc-0003uE-7c for pgsql-hackers@lists.postgresql.org; Fri, 17 Feb 2023 08:37:52 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pSwFV-0003Hy-DE for pgsql-hackers@lists.postgresql.org; Fri, 17 Feb 2023 08:37:51 +0000 Received: by mail-wm1-x32c.google.com with SMTP id x12-20020a05600c21cc00b003e00c739ce4so283490wmj.5 for ; Fri, 17 Feb 2023 00:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6KcKw/ZF6t3irxOlU27LNJZu4ftwK6b6pdLdBsUjaDY=; b=RiBLrWEcW/eTqoueNC2a/1i2561jD5tz7E82BxMY0FwAa4NSGhG1npfdWxT2CHsrEX UPOwUS2mwDGYYFVQ3EUi9nNmeldVnjTJu91y7JYAsOtg7jGKJN7rg15EQgfRr9KjHSWG fG2zN4sVeDeEztoQXWRUiU/vBTmMP39bV0gde2VmvFBonfjcN4yhXWgwaEM/EanAia+Q w9IJH+cjEEuNnz6RZQ7N+DRyxZrcT8/jwouoXap7a2QTvHCmwAH/SZSbk3XShKzpoeVg 9VpE5ZiynvhZrltdQkdVShYihfQjfdkAqcOLkYrvdknQ6svavu7g4PdDAp2z15pOqVgs YQYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6KcKw/ZF6t3irxOlU27LNJZu4ftwK6b6pdLdBsUjaDY=; b=ste6IP49EbXn3OXqwC6k6nNXNZTbBVJtYsdfl14X9ENhyHZb29vUWEsWWXt+aef7Gx vy35vTnP7uYlxkQllVHW2rjPn7JYv2oGJ396ErrCeshvlIH4ql22S/7G3FL63n5i1Esf Y2kbESz+3sw/oChtia3h+nXvsJUrJEwkQP58idGx0CQw9iNZUYCqabq2uLRn7y+lyKbp wmpL8T0Dwm4gu04+z5UyIaqzfNzJmXHaZ5j9oLNb9Jn185hZ3kOuwBXd6T7UQ2mCxBkl wxPf05Se769R/q3weGiF34WfPWyxctY9EiJqb+Nb2Bi7lCsG7cyUal4IctEesaSUJQnu JM4A== X-Gm-Message-State: AO0yUKWViD6uekOgD7cUtkAKzaoxpVks2KX9jEWOcVcIyweo4vh/w+oD CzcR+QW4r8Ds2zLTe4YlvLxd9D71CmEvmw== X-Google-Smtp-Source: AK7set/RmIz7t2mSZoy9Nfa0/ntk3CZYTWynfN8HU54IgaZUirpinlAci5B7qw6ZP2zPBHSvLITjoA== X-Received: by 2002:a05:600c:1714:b0:3dc:43a0:83bb with SMTP id c20-20020a05600c171400b003dc43a083bbmr443055wmn.3.1676623063962; Fri, 17 Feb 2023 00:37:43 -0800 (PST) Received: from [192.168.30.228] ([54.239.6.187]) by smtp.gmail.com with ESMTPSA id n6-20020a05600c500600b003dc433355aasm4358608wmr.18.2023.02.17.00.37.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Feb 2023 00:37:43 -0800 (PST) Message-ID: <14965f63-6d78-45ff-d029-daafe8eddb40@gmail.com> Date: Fri, 17 Feb 2023 09:36:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Normalization of utility queries in pg_stat_statements To: Michael Paquier Cc: Postgres hackers References: <0e067034-e92c-302b-24ed-492bca228e26@gmail.com> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2/17/23 3:35 AM, Michael Paquier wrote: > On Thu, Feb 16, 2023 at 10:55:32AM +0100, Drouvot, Bertrand wrote: >> In the new pg_stat_statements.sql? That way pg_stat_statements.sql would always behave >> with default values for those (currently we are setting both of them as non default). >> >> Then, with the default values in place, if we feel that some tests >> are missing we could add them in > utility.sql or planning.sql >> accordingly. > > I am not sure about this part, TBH, so I have left these as they are. > > Anyway, while having a second look at that, I have noticed that it is > possible to extract as an independent piece all the tests related to > level tracking. Things are worse than I thought initially, actually, > because we had test scenarios mixing planning and level tracking, but > the tests don't care about measuring plans at all, see around FETCH > FORWARD, meaning that queries on the table pg_stat_statements have > just been copy-pasted around for the last few years. There were more > tests that used "test" for a table name ;) > > I have been pondering about this part, and the tracking matters for DO > blocks and PL functions, so I have moved all these cases into a new, > separate file. There is a bit more that can be done, for WAL tracking > and roles near the end of pg_stat_statements.sql, but I have left that > out for now. I have checked the output of the tests before and after > the refactoring for quite a bit of time, and the outputs match so > there is no loss of coverage. > > 0001 looks quite committable at this stage, and that's independent on > the rest. At the end this patch creates four new test files that are > extended in the next patches: utility, planning, track and cleanup. > Thanks! LGTM. >> 0002: >> >> Produces: >> v2-0002-Add-more-test-for-utility-queries-in-pg_stat_stat.patch:834: trailing whitespace. >> CREATE VIEW view_stats_1 AS >> v2-0002-Add-more-test-for-utility-queries-in-pg_stat_stat.patch:838: trailing whitespace. >> CREATE VIEW view_stats_1 AS >> warning: 2 lines add whitespace errors. > > Thanks, fixed. > Thanks! >> +-- SET TRANSACTION ISOLATION >> +BEGIN; >> +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; >> +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; >> +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; >> >> What about adding things like "SET SESSION CHARACTERISTICS AS >> TRANSACTION..." too? > > That's a good idea. It is again one of these fancy cases, better to > keep a track of them in the long-term.. > Right. 002 LGTM. >> 0003 and 0004: >> Thanks for keeping 0003 that's useful to see the impact of A_Const normalization. >> >> Looking at the diff they produce, I also do think that 0004 is what >> could be done for PG16. > > I am wondering if others have an opinion to share about that, but, > yes, 0004 seems enough to begin with. We could always study more > normalization areas in future releases, taking it slowly. Agree. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com