Another modest proposal for reducing CLOBBER_CACHE_ALWAYS runtime

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Another modest proposal for reducing CLOBBER_CACHE_ALWAYS runtime
Date: 2021-05-10 06:03:58
Message-ID: 575884.1620626638@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noted that, while privileges.sql doesn't stand out in terms of
runtime normally (it's only the fourth slowest test in its
parallel group), it looks absolutely horrid in CLOBBER_CACHE_ALWAYS
testing. On hyrax's latest run, it takes nearly 9000 seconds longer
than the next-slowest member of its group. Remembering that the
core regression tests are run thrice in a minimal buildfarm cycle,
this test is single-handedly responsible for over seven hours of the
54 hour total build cycle.

I dug into it and found that the core issue is much like that in
opr_sanity.sql, namely that we're repeating this plpgsql function
$bignum times:

CREATE FUNCTION leak(integer,integer) RETURNS boolean
AS $$begin return $1 < $2; end$$
LANGUAGE plpgsql immutable;

(I wonder whether the planner needs to invoke this function
quite so many times during selectivity estimation. But,
again, improving that seems like a task for some other day.)

Now, as far as I can see, this function definition isn't doing
anything we can't do with an alias for the underlying int4lt
function: the fact that the implementation is in plpgsql
shouldn't matter at all for the purposes of this test.
So I replaced it, as per the attached patch.

On my machine, the time to run privileges.sql under
debug_invalidate_system_caches_always = 1
drops from

real 293m31.054s
to
real 1m47.807s

Yes, really.

regards, tom lane

Attachment Content-Type Size
make-leak-a-C-function.patch text/x-diff 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-05-10 06:12:47 Re: COPY table_name (single_column) FROM 'unknown.txt' DELIMITER E'\n'
Previous Message Bruce Momjian 2021-05-10 06:03:08 PG 14 release notes, first draft