Reduce runtime of privileges.sql test under CLOBBER_CACHE_ALWAYS.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 May 2021 00:59:45 +0000 (20:59 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 May 2021 00:59:58 +0000 (20:59 -0400)
commite135743ef07ea59088d09c459f41ee2eaabe95c3
tree5540c88c66b6b3f5505cfcdbdcc46e9ba67d2f7d
parentd780d7c0882fe9a385102b292907baaceb505ed0
Reduce runtime of privileges.sql test under CLOBBER_CACHE_ALWAYS.

Several queries in the privileges regression test cause the planner
to apply the plpgsql function "leak()" to every element of the
histogram for atest12.b.  Since commit 0c882e52a increased the size
of that histogram to 10000 entries, the test invokes that function
over 100000 times, which takes an absolutely unreasonable amount of
time in clobber-cache-always mode.

However, there's no real reason why that has to be a plpgsql
function: for the purposes of this test, all that matters is that
it not be marked leakproof.  So we can replace the plpgsql
implementation with a direct call of int4lt, which has the same
behavior and is orders of magnitude faster.  This is expected to
cut several hours off the buildfarm cycle time for CCA animals.
It has some positive impact in normal builds too, though that's
probably lost in the noise.

Back-patch to v13 where 0c882e52a came in.

Discussion: https://postgr.es/m/575884.1620626638@sss.pgh.pa.us
src/test/regress/expected/privileges.out
src/test/regress/sql/privileges.sql