Invent an assign-hook mechanism for psql variables similar to the one
Tom Lane <tgl@sss.pgh.pa.us>
Invent an assign-hook mechanism for psql variables similar to the one existing for backend GUC variables, and use this to eliminate repeated fetching/parsing of psql variables in psql's inner loops. In a trivial test with lots of 'select 1;' commands, psql's CPU time went down almost 10%, although of course the effect on total elapsed time was much less. Per discussion about how to ensure the upcoming FETCH_COUNT patch doesn't cost any performance when not being used.
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/psql/command.c | modified | +19 −53 |
| src/bin/psql/common.c | modified | +12 −16 |
| src/bin/psql/copy.c | modified | +2 −2 |
| src/bin/psql/describe.c | modified | +4 −4 |
| src/bin/psql/input.c | modified | +10 −43 |
| src/bin/psql/large_obj.c | modified | +3 −5 |
| src/bin/psql/mainloop.c | modified | +6 −8 |
| src/bin/psql/prompt.c | modified | +6 −10 |
| src/bin/psql/settings.h | modified | +52 −7 |
| src/bin/psql/startup.c | modified | +171 −31 |
| src/bin/psql/variables.c | modified | +98 −58 |
| src/bin/psql/variables.h | modified | +24 −29 |