Re: Faster "SET search_path" - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Faster "SET search_path"
Date
Msg-id 262cdb8a87c5e1fdb59ef2559c2a4a6006410dff.camel@j-davis.com
Whole thread Raw
In response to Re: Faster "SET search_path"  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Faster "SET search_path"
List pgsql-hackers
On Tue, 2023-08-15 at 13:04 -0400, Robert Haas wrote:
> I suspect that dodging the GUC stack machinery is not a very good
> idea. The timing of when TRY/CATCH blocks are called is different
> from
> when subtransactions are aborted, and that distinction has messed me
> up more than once when trying to code various things.

...

> I can't say there isn't a way to make something like what you're
> talking about here work, but I bet it will be difficult to get all of
> the corner cases right, and I suspect that trying to speed up the
> existing mechanism is a better plan than trying to go around it.

The SearchPathCache that I implemented (0003) is an example of speeding
up the existing mechnism that and already offers a huge speedup. I'll
focus on getting that in first. That patch has had some review and I'm
tempted to commit it soon, but Nathan has requested another set of eyes
on it.

To bring the overhead closer to zero we need to somehow avoid repeating
so much work in guc.c, though. If we don't go around it, another
approach would be to separate GUC setting into two phases: one that
does the checks, and one that performs the final change. All the real
work (hash lookup, guc_strdup, and check_search_path) is done in the
"check" phase.

It's a bit painful to reorganize the code in guc.c, though, so that
might need to happen in a few parts and will depend on how great the
demand is.

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Jacob Champion
Date:
Subject: Re: Logging of matching pg_hba.conf entry during auth skips trust auth, potential security issue