]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pgstattuple: Optimize pgstattuple_approx() with streaming read
authorMichael Paquier <michael@paquier.xyz>
Sat, 14 Mar 2026 06:06:13 +0000 (15:06 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 14 Mar 2026 06:06:13 +0000 (15:06 +0900)
commitae58189a4d523f0156ebe30f4534180555669e88
tree56e7daa8baa4104a5dcace25d571acde67069c55
parent4deecb52affa4b6f791e8a57f6584610e4dd12f4
pgstattuple: Optimize pgstattuple_approx() with streaming read

This commit plugs into pgstattuple_approx(), the SQL function faster
than pgstattuple() that returns approximate results, the streaming read
APIs.  A callback is used to be able to skip all-visible pages via VM
lookup, to match with the logic prior to this commit.

Under test conditions similar to 6c228755add8 (some dm_delay and
debug_io_direct=data), this can substantially improve the execution time
of the function, particularly for large relations.

Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com
contrib/pgstattuple/pgstatapprox.c
src/tools/pgindent/typedefs.list