Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tabBv-003K8B-Pu for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 13:54:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tabBu-00HMEU-Qt for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 13:54:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tabBu-00HMEM-HY for pgsql-hackers@lists.postgresql.org; Wed, 22 Jan 2025 13:54:46 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tabBr-000us7-1o for pgsql-hackers@lists.postgresql.org; Wed, 22 Jan 2025 13:54:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1737554080; bh=Pp9hSxpjsJxVc1tvQYjU2XBrEo+ialpArH38oQjpMGQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=7mAeu5tJ9Ao4uKfIrYsPGAmlARBrBFk4zkCfKQaUUDkUiTIf1mvF7O6VRP3nPhVa5 TvnCWQXd0RSog6IrTb4n3HDnJ+z9uO+9vO+3Qxk7GhxMcSAVh4Dcl7dmV//T5ssGwm JAZ0OoioFDnJWKwSrP0Qx6PcBflBIA/6XymEYCZvXO4ljfdJPnqoOhPYULr8N/OFB4 jT8q9e/XTffj4G81c64GxHMlRBbI+nNTNnWmtqu8UXxZPT9eKUkLg/c0wfMkejEYdR FoXgLtiVfgQHaC9EMVHstnRdNRMTw2AriOmxjOaO2DQYVl6RDzW7qo596zdDELFPXZ U2GPrOQG7hgLQ== Received: from mail.postgrespro.ru (webmail-slave-mstn.l.postgrespro.ru [192.168.2.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: m.litsarev@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 6F3826084F; Wed, 22 Jan 2025 16:54:40 +0300 (MSK) MIME-Version: 1.0 Date: Wed, 22 Jan 2025 16:54:40 +0300 From: m.litsarev@postgrespro.ru To: Ivan Kush , samimseih@gmail.com Cc: pgsql-hackers@lists.postgresql.org Subject: Re: pg_stat_statements: improve loading and saving routines for the dump file In-Reply-To: References: <192f7185defa370d083e3a237727b066@postgrespro.ru> <63fd7f0d-2d49-4952-b1ec-fa877bbf0765@tantorlabs.com> <181d7759a2ed7d819add4e0086e7a7f9@postgrespro.ru> Message-ID: <0231a188cf457095458ba9759ac21ea1@postgrespro.ru> X-Sender: m.litsarev@postgrespro.ru Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-KSMG-AntiPhishing: NotDetected, bases: 2025/01/22 12:52:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/01/22 10:19:00 #27099507 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > What does this patch give on aglobal scale? Does it save much memory or > increase performance? How many times? This patch makes the code semantically more correct and we don't lose anything. It is obviously not about performance or memory optimisation. > This will only reduce the size of the > $PGDATA/pg_stat/pg_stat_statements.txt file. Even with > 100k entries, the most I have seen pg_stat_statements.max > set to, that will be less than 1 MB of disk saving. The default > config of 5k entries will be much less. Perfectly agree. I would just add that statistics are dropped into the pg_stat_statements.txt file at server stop which is not a very frequent event. Respectfully, Mikhail Litsarev, Postgres Professional: https://postgrespro.com