Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite135743

Browse files
committed
Reduce runtime of privileges.sql test under CLOBBER_CACHE_ALWAYS.
Several queries in the privileges regression test cause the plannerto apply the plpgsql function "leak()" to every element of thehistogram for atest12.b. Since commit0c882e5 increased the sizeof that histogram to 10000 entries, the test invokes that functionover 100000 times, which takes an absolutely unreasonable amount oftime in clobber-cache-always mode.However, there's no real reason why that has to be a plpgsqlfunction: for the purposes of this test, all that matters is thatit not be marked leakproof. So we can replace the plpgsqlimplementation with a direct call of int4lt, which has the samebehavior and is orders of magnitude faster. This is expected tocut several hours off the buildfarm cycle time for CCA animals.It has some positive impact in normal builds too, though that'sprobably lost in the noise.Back-patch to v13 where0c882e5 came in.Discussion:https://postgr.es/m/575884.1620626638@sss.pgh.pa.us
1 parentd780d7c commite135743

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

‎src/test/regress/expected/privileges.out

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ ALTER GROUP regress_priv_group2 ADD USER regress_priv_user2;-- duplicate
3838
NOTICE: role "regress_priv_user2" is already a member of role "regress_priv_group2"
3939
ALTER GROUP regress_priv_group2 DROP USER regress_priv_user2;
4040
GRANT regress_priv_group2 TO regress_priv_user4 WITH ADMIN OPTION;
41+
-- prepare non-leakproof function for later
42+
CREATE FUNCTION leak(integer,integer) RETURNS boolean
43+
AS 'int4lt'
44+
LANGUAGE internal IMMUTABLE STRICT; -- but deliberately not LEAKPROOF
45+
ALTER FUNCTION leak(integer,integer) OWNER TO regress_priv_user1;
4146
-- test owner privileges
4247
SET SESSION AUTHORIZATION regress_priv_user1;
4348
SELECT session_user, current_user;
@@ -233,9 +238,6 @@ ALTER TABLE atest12 SET (autovacuum_enabled = off);
233238
SET default_statistics_target = 10000;
234239
VACUUM ANALYZE atest12;
235240
RESET default_statistics_target;
236-
CREATE FUNCTION leak(integer,integer) RETURNS boolean
237-
AS $$begin return $1 < $2; end$$
238-
LANGUAGE plpgsql immutable;
239241
CREATE OPERATOR <<< (procedure = leak, leftarg = integer, rightarg = integer,
240242
restrict = scalarltsel);
241243
-- views with leaky operator

‎src/test/regress/sql/privileges.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ ALTER GROUP regress_priv_group2 ADD USER regress_priv_user2;-- duplicate
4545
ALTERGROUP regress_priv_group2 DROP USER regress_priv_user2;
4646
GRANT regress_priv_group2 TO regress_priv_user4 WITH ADMIN OPTION;
4747

48+
-- prepare non-leakproof function for later
49+
CREATEFUNCTIONleak(integer,integer) RETURNSboolean
50+
AS'int4lt'
51+
LANGUAGE internal IMMUTABLE STRICT;-- but deliberately not LEAKPROOF
52+
ALTERFUNCTION leak(integer,integer) OWNER TO regress_priv_user1;
53+
4854
-- test owner privileges
4955

5056
SET SESSION AUTHORIZATION regress_priv_user1;
@@ -166,9 +172,6 @@ SET default_statistics_target = 10000;
166172
VACUUM ANALYZE atest12;
167173
RESET default_statistics_target;
168174

169-
CREATEFUNCTIONleak(integer,integer) RETURNSboolean
170-
AS $$begin return $1< $2; end$$
171-
LANGUAGE plpgsql immutable;
172175
CREATE OPERATOR<<< (procedure= leak, leftarg=integer, rightarg=integer,
173176
restrict= scalarltsel);
174177

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp