Re: Faster "SET search_path"
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Isaac Morland <isaac.morland@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-08-16T22:09:43Z
Lists: 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
Commits
-
Fix missing invalidations for search_path cache.
- b3bd18294ee4 18.0 landed
- d3e076549b99 17.0 landed
-
Optimize SearchPathCache by saving the last entry.
- a86c61c9eefa 17.0 landed
-
Optimize check_search_path() by using SearchPathCache.
- ad57c2a7c586 17.0 landed
-
Be more paranoid about OOM in search_path cache.
- 8efa301532c8 17.0 landed
-
Add cache for recomputeNamespacePath().
- f26c2368dcae 17.0 landed
-
Transform proconfig for faster execution.
- 5765cfe18c59 17.0 landed