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 1w7FhE-0057IN-1U for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 16:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7FhC-004oNI-1M for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 16:42:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7FhC-004oN4-0J for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 16:42:34 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7Fh9-000000021cw-2WXu for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 16:42:34 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-43b983bb07eso2394236f8f.0 for ; Mon, 30 Mar 2026 09:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774888951; x=1775493751; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:user-agent:reply-to :references:in-reply-to:message-id:date:cc:subject:to:from:from:to :cc:subject:date:message-id:reply-to; bh=oF8yBIOOHR4buCwLUdgAKlrgPBfCMPPgGJV7F1Wouss=; b=OMhmJNn43CO8LvPciBYzrVTpihvj6JxXT0PHBEVLZufavqQjSexEVB6/ajMwmmA/Ny zFECn5JiR1ij7uggnpiCP9/x3dCuJEKrPB5Oec6JTb2+P2HsR4pXiWrmO5ykqmqoV5FP DYPb3NBTbo/SOvQIxymToioDCR3niWjr+7Oq2UO+aLpzTv6yTUjjhprhe1hA5ASfD4od ifdP5Y3CAmwWJUAQ3n7W1rrpAtIXLEf3fgV3tNvYVlDQW2ddzox+6QklsCSnfYGbaKzu yjOEuMhT7i6t+xJ+OK0/pApwjnqwFUeN69dGqJCCmy3vslVEZ6zHueuuHOdBUrP15Qnv llBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774888951; x=1775493751; h=content-transfer-encoding:mime-version:user-agent:reply-to :references:in-reply-to:message-id:date:cc:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oF8yBIOOHR4buCwLUdgAKlrgPBfCMPPgGJV7F1Wouss=; b=cnIkB/h1K9WjBfzvRAkM9IbLBnSu+9yUn/cFGndxygzZtPyyoYFyvUbl8l4fiLkOW3 S1oKT6dwpXkFmv/PhtquQBnKAfK7i7Sg/PiqtgnF/f2/9EjrtAj4tmzh54npeI+Tu7yl z/I7fTD3/6oQup7Yr6mqIEnYtsgnSfdTeOjU15MnupDz6yYLpnC7EkGpE5FLnXkbmsHA dv2sDGrpDjEf4kmc1CMtkIVpFT3+gdD+15oP3znwzD4OcK4QOesFp8duqumZQOS91aaF HkdfQo9HBR5YMKtgtV5WJYRP1pDfxVLMCiqnvCsxxANh34uEM+q7A9NY8z2h+i4gsU9p Rt5g== X-Forwarded-Encrypted: i=1; AJvYcCXC83okYC5HoCt1VSue2y6yuVgxkxUA+QLFPrd3oA59IzIVxsS0M2sC3Jgd4x94gMl6cIoO45fbntYxZD6t@lists.postgresql.org X-Gm-Message-State: AOJu0Yz3QAe8AS7dUy/NsBjVegrjlPUu40iwLyirkRzT7ewx7AHIYfcJ bVtCn0m+2SQApCJgy8qHQM3sm9c+TSLHxRIgTy/4g9U6pmC71eZvKXk0qrtfE90RfLY= X-Gm-Gg: ATEYQzxzTuDJjLcgAgYg4b9jCVxN8WlIM8if0rrpJeykv3JfDz4JIXw5GjOVAlinhbB TMvAR11LJvs8Jc5ifjttjsl97b5+HzvyAikIoCYfVXlUlshAcbFRTkRsRiAk549QZKXqCk5OIj7 FjyjaM035bC1uz3MoaiAwZBa1ptu6fWng+v6eSZWwKU0SEytZPP2tWKVZ9XXQ6847jScWkCMt/Y yrhVoWvTkYSLUO6DrQWmkokvQEVtwX+o4EtCwYg0z45vuVweH2o+evQQwsJ3oEQg3LnbvXaf6JU DyI5COhJNT6GkliXpP8sod0aRdnGdGXKASpzi2fyrFkbQbd8K2Wvg2NndigdDYvWNXx8mrojis9 JxYew7+WQ8u0WoVkQKXVAPakYVO9K4BjerzKbry/aLQKAbi8Uc7qCw3Dm46CuEWyM4W37kZ78TY dccoajvwsz5q6aB1TgiRe6d5R1CweR1BuQJDBCZRmC6hiQIlveJFAeEmRS7IV6hw== X-Received: by 2002:a05:6000:290e:b0:435:e3bd:5838 with SMTP id ffacd0b85a97d-43b9ea46b84mr21623219f8f.25.1774888950577; Mon, 30 Mar 2026 09:42:30 -0700 (PDT) Received: from ?IPv6:::ffff:192.168.0.101? ([62.197.243.85]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e2727sm22244581f8f.2.2026.03.30.09.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 09:42:30 -0700 (PDT) From: "Pavlo Golub" To: "Sami Imseih" Subject: Re[2]: [PATCH] Add last_executed timestamp to pg_stat_statements Cc: "Christoph Berg" , "Bertrand Drouvot" , "pgsql-hackers@lists.postgresql.org" Date: Mon, 30 Mar 2026 16:42:29 +0000 Message-Id: In-Reply-To: References: Reply-To: "Pavlo Golub" User-Agent: eMClient/10.4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > >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 =3D=3D PGSS_PLAN || kind =3D=3D 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 =3D 29351.794589 (without initial connection time) >tps =3D 29470.287111 (without initial connection time) >tps =3D 29902.245458 (without initial connection time) > >## with GetCurrentTimestamp() >tps =3D 28569.471891 (without initial connection time) >tps =3D 28013.051778 (without initial connection time) >tps =3D 28518.468843 (without initial connection time) > >I see around 4-5% performance degradation. Yeah, I can confirm. I have the same degradation on my local=20 environment. Thanks for pointing this out! I sent a new patch with a new column `last_execution_start`. I hope it=20 could make it before freeze. :) =20 https://www.postgresql.org/message-id/em5619eed4-8913-4ee8-a3cd-9f7101b06b6= d%40cybertec.at Best regardsz