Repository navigation
Drop the session TimeZone conversion from stdlib - #5
Merged
Merged
Conversation
initValueFuncs resolved ParameterStatus("TimeZone") through
time.LoadLocation for every timestamptz value scanned. Go reparses the
zoneinfo file on each call for a named zone, so the same 100k-cell result
cost 484ms and 133MB of allocation on a non-UTC database against 23ms and
2.3MB on a UTC one.
The per-value lookup bought no accuracy for that. PostgreSQL reports a
TimeZone change at command completion, after the rows, so every value in
one result set resolves the same setting: a statement that changes the
zone mid-flight still decodes its own rows under the old one.
Callers can read the setting once per statement and apply the location
themselves, which also lets them fall back instead of failing a query
whose TimeZone is a POSIX specification time.LoadLocation cannot parse,
such as "+08:00" or "EST5EDT,M3.2.0/2,M11.1.0/2".
This reapplies #3, which #4 reverted so that an unrelated dependency bump
carried no behavior change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
initValueFuncsresolvedParameterStatus("TimeZone")throughtime.LoadLocationfor every timestamptz value scanned. Go reparses the zoneinfo file on each call for a named zone, so the cost landed per cell:Same query, 20k rows x 5 timestamptz, only the session zone differing:
The per-value lookup bought no accuracy for that. PostgreSQL reports a
TimeZonechange at command completion, after the rows, so every value in one result set resolves the same setting — measured with the patch in place:So a caller can read the setting once per statement and apply the location itself for the same result, which also lets it fall back rather than fail a query whose
TimeZoneis a POSIX specificationtime.LoadLocationcannot parse (+08:00,EST5EDT,M3.2.0/2,M11.1.0/2) — something this code can only turn into a bare scan error that aborts the rest of the batch.The
ColumnTypePrecisionScalepatch is untouched.This reapplies #3, which #4 reverted so that an unrelated dependency bump carried no behavior change. The resulting tree is identical to the one reviewed there:
git diff a6d159db HEADis empty.🤖 Generated with Claude Code