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 1tZuPr-00EEXZ-9o for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 16:14:19 +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 1tZuPo-003iRn-FV for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 16:14:16 +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 1tZuPo-003iRY-6o for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2025 16:14:16 +0000 Received: from forward502b.mail.yandex.net ([178.154.239.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tZuPk-000ZmX-0n for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2025 16:14:15 +0000 Received: from mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:288b:0:640:e413:0]) by forward502b.mail.yandex.net (Yandex) with ESMTPS id 2D081608DD for ; Mon, 20 Jan 2025 19:14:09 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 7EYx3LVOeW20-pe4sNO8G; Mon, 20 Jan 2025 19:14:08 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1737389648; bh=STmsOA/f1lZIH7gawGO2csTFlMdh4LZLEfhtiMN4Flo=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=iYVWM4U34TCJcTlVKSx8kW+u6Ur2Qm7iGQsJ8VAn1t2UC+Ymp6nufHHi37XflrCZm jxL3Y9Toc5uSzpuO5f2J6muC3iN7idiq5ojK2FV7NCJZMdmD2vMljKp2fBVySw0BNA H3imrSybGkewsk2idv0I6flbNU/tX/AQdeVD/mHY= Authentication-Results: mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Message-ID: <63fd7f0d-2d49-4952-b1ec-fa877bbf0765@tantorlabs.com> Date: Mon, 20 Jan 2025 19:14:07 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_stat_statements: improve loading and saving routines for the dump file To: pgsql-hackers@lists.postgresql.org References: <192f7185defa370d083e3a237727b066@postgrespro.ru> Content-Language: en-US From: Ivan Kush Organization: Tantor Labs LLC In-Reply-To: <192f7185defa370d083e3a237727b066@postgrespro.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, Mikhail. 1) I'd add to comment a reason, why mutex should be last. // Mutex should be last field, as this field isn't copied to dump file + /* protects the counters only. Should be the very last field, as this field isn't copied to dump file + slock_t mutex; } pgssEntry; 2) You didn't take into account the upgrade. Saved in Postgres with this byte and try to load in version without this byte. On 1/20/25 16:49, m.litsarev@postgrespro.ru wrote: > Hi! > > Currently in pg_stat_statements save/load routines the whole pgssEntry > entity data are written/read with its last field > slock_t        mutex; > which is actually not used then. > This small patch fixes this issue. Hope, it will be useful. > > Respectfully, > > Mikhail Litsarev, > Postgres Professional: https://postgrespro.com -- Best wishes, Ivan Kush Tantor Labs LLC