Store session info in db variables instead of in temp table #811
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This avoids the CREATE TEMP TABLE that is run at the beginning of every GMP
session, by instead storing the info in Postgres session variables.
These CREATE TEMP TABLEs were about 10% of the total SQL time on my example
report. With this PR these statements no longer appear in the pg_stats summary,
but it is hard to see if the total time improved. Sometimes it is a low as 390ms
but sometimes it is 450ms as before.
I thought perhaps the total time was not consistently lower because of accessing
the session vars in the result iterator columns and SQL functions. So I've
added commits which move these accesses out into the opts "table". This
does not seem to improve the situation, but I'm leaving them in here
because they're a start towards not needing the session variables at all. That's
good because: 1 It will save us a percent or two not having to set them up, 2 the
SQL functions will be simpler (and maaaybe some will be faster).
Checklist: