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.96) (envelope-from ) id 1vsUyY-0046ae-2Z for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Feb 2026 23:59:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsUyX-00D8y3-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Feb 2026 23:59:29 +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.96) (envelope-from ) id 1vsUyX-00D8xp-0j for pgsql-hackers@lists.postgresql.org; Tue, 17 Feb 2026 23:59:29 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsUyU-000000018Nz-3hLQ for pgsql-hackers@lists.postgresql.org; Tue, 17 Feb 2026 23:59:28 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-65c01595082so3517795a12.3 for ; Tue, 17 Feb 2026 15:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771372765; cv=none; d=google.com; s=arc-20240605; b=XcyBzqTV5Ngq0XSVkdcrzShVyrYuCdS7i2D1iGT6grnHErxSQDWBjJff4r1SOxwf00 gIHAOqwvRDeZ93UGR6zm/w98OsMFd/CapA/cSBhISbIlvGEI0FfJnZOYXm4jWyo1pJfW p1EUvquyFb1xsZED0mNVbGvqj7+W0bAE0iILDfzLOIwyGhhXIN/4AMLGV02gDRKYvt3U nFD3UGX/4edaqHjExxf5lQIQtt7cjZq5hkGJrkJo1ZaQk8VNhIOwVy0fT9MX7Le7NcSS gEtg53OgZ0s23tlVdxyJ3qJZaZQg3pO7U/SmiK6aRNZFgXDuB0Sb5WCQl9ePzlwdtJks HOAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=mKKKyHn1VJdRVTCv0YYDA0IZjdEP4m8UPCjbG2Y18MI=; fh=xErtgX7JpFcH9KbvrBNUZNfV4eP+loXXLTuFKyXGw0c=; b=UYckFhE2ZV4hMiBJeNExOyRua4CuvD4aInRa1BJbbVOzsab9gixyFlO7hgidTUwCRl qqO23JgWx+iatDZwblId75pvtgbc2d7238Vbquc/3llna6X4EwA0vLLFUPCMK1gzbQo7 BPKUJ6TtRgI5WbRQ1UAyDvQniyUzLH5eMYshnlargOcXROFjtKNGCZtVTfBlRSWCTh/W 5vkmMVzvRGMIrOEPcDoTOHuNAYnQWeRXT4BkvzqxtOQrIB+8bZj58vJembtWFsvaklRu aIzptRiM3TJGRCfhRI8aZ2emqqsr8JM/+Iz+WxNvqtXpezx9fOy4BSgK1QETvnVXwq9J mhPQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771372765; x=1771977565; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mKKKyHn1VJdRVTCv0YYDA0IZjdEP4m8UPCjbG2Y18MI=; b=CPVhBWqbrdnhmcMnhUSSXmaEjdpxHGcLjcjXWNuB0/ejEZ+fdbxjXFj2oEqo73clU4 26ZPUfH+EcOra1qOy2oELQH/5SmGHj9Yj5nGuCvQ1ZdIqRbxLyjmLXf8bziGTEgQzXWk fx0R1U/EET0D5EAE2wHSzjabQ2YCpY8cJ4PRqxHz3W1I+hQrELwq+l7pAiBx/SSKyRwt gKRWBiru1fYVu/bcQD9dUSF73pYGd61UPPdJpfQ40buzNN1J++/A3PIWiO9XzSI+/Aee p4aVf+QUkDFZ8Je6XSpt7vNTFjUgqFkHx0WNtiOyMVxwxZQ31qUj/wPUyooAxVcMFuzo WNWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771372765; x=1771977565; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mKKKyHn1VJdRVTCv0YYDA0IZjdEP4m8UPCjbG2Y18MI=; b=uJhxBq7YdMlAuO1mGXP5RkfZsPHa1XMPjSI3XjbSllSR8vnOpmInvkJcIl4nSBG6+n ovXkSr7JV1iv/sW2vZMrHCAQbclsx4WAGKT9c6S2TllMIO7j3kuTovpplcVx1sT+5wy5 tXNzHG7TAdZJndRyuMqdFTOLilaBdaOfhcIl0eX+SweCBUKayo4Rv3Ty6mqS/4JCx+SS h8NDcQjlZa3lAzUnQWsfwha+Rjozmmz66gKKcj6K3m2K0hUCjPxUCNLxb+l0Rj7usmJD 3qREFcG8csuASB/oFSfiQXYlEf3TfM1XtOgAyuBqE4d8YaowMkOEIB0FyBnufM/mH1PH xe6A== X-Forwarded-Encrypted: i=1; AJvYcCWnNZe/TCDAVT220auBh2hUUCnsLTtEgl4qWsOrazur5LE4GJv4BcZ7UziQZJxQrXNajcLSfbXD2n6Au6li@lists.postgresql.org X-Gm-Message-State: AOJu0YzEXMDBWSor8+JGdn/WSlX2iCx589OcvDRs6053FYm6CtYxBzQE xOMfg4fOvTyrt0n9H1wT0fVncSo5U3S9NEACm7S2ZEZt623Ylbqt3F0uZanuJMBKq5R8+pQaTYJ uJrbwWMyEVIBhIEu9kdnHKlgoUW3xty8CpgXO X-Gm-Gg: AZuq6aKJ6uUZ2BliqgBqm75C63HmuQ9OZJerEY/GLA+X71w+fkIOKeBySGXvLDw+tQc qQHiReY7R2v912anNxgcCSffmpHPeXuTJJFiYGteyQB9JhW85JX6QyeaXhy1qSCs19Zdn4mlmfo 64dCZHyJns+0kS/sjGhUKP7lv4t9q8XgJQxNMWo92/Ay15VCFc4b0GwnY+FZu6ROwoS5sX7j8In hXtcZQQ1y+MolYbSeK270rulKWtqpLGpo317kzJajsLUxrtDk3Q8MNhOqOPD7BaaGi/g4BvKuBQ qg== X-Received: by 2002:a17:906:c10f:b0:b8f:9636:9acc with SMTP id a640c23a62f3a-b8fb4219140mr816144966b.17.1771372764730; Tue, 17 Feb 2026 15:59:24 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Tue, 17 Feb 2026 17:59:12 -0600 X-Gm-Features: AaiRm50PM-74s8BwCbSBtxKWIoSVs9jEe10244ZLMGL-YyjnBcR3e3MCny-Vy9s Message-ID: Subject: Re: [PATCH] Add last_executed timestamp to pg_stat_statements To: Pavlo Golub Cc: Christoph Berg , Bertrand Drouvot , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > > I am not sure if this benchmark is enough to build confidence in this approach. > > Workloads with nested queries and tack. 'all' are now paying an even heavier > > cost. > > I would love to see and test sql that will reveal the bigger overhead. > Do you have something specific on your mind? I'd love to share > results, we can use them later considering further updates to pgss. Here is something I was experimenting with today. I ran 2 benchmarks; one on HEAD and one with GetCurrentTimestamp() added when we are accumulating stats. """ /* Increment the counts, except when jstate is not NULL */ if (!jstate) { Assert(kind == PGSS_PLAN || kind == PGSS_EXEC); GetCurrentTimestamp(); """ The benchmak script is a series of "SELECT;" # select_tx.sql """ begin; select; select; select; select; select; select; select; select; select; select; select; select; select; select; select; end; """ The benchmark was on my Ubuntu on EC2 c5a.12xlarge, with default pg_stat_statements settings ( no plan tracking and top tracking only ). pgbench command: ``` pgbench -c48 -j16 -P1 -f select_tx.sql -T120 ``` Results for 3 runs ## HEAD tps = 29351.794589 (without initial connection time) tps = 29470.287111 (without initial connection time) tps = 29902.245458 (without initial connection time) ## with GetCurrentTimestamp() tps = 28569.471891 (without initial connection time) tps = 28013.051778 (without initial connection time) tps = 28518.468843 (without initial connection time) I see around 4-5% performance degradation. -- Sami Imseih Amazon Web Services (AWS)