design: correct the fetch plan's ordering - #145
Merged
Conversation
…he check The plan put a needed-columns bitmap first, on the argument that the uniqueness check only needs the key columns. Reading the call path before writing any of it says otherwise: core's table_index_fetch_tuple_check creates a slot, calls table_index_fetch_tuple, and discards it, so the access method cannot tell that call from a real fetch and columnar_index_fetch_tuple fills every column either way. The caller that would benefit most has no way to declare what it needs. The statement-scoped decoded-group cache moves first, since it is the only piece that helps every caller. Also records that GetCurrentCommandId is enough to scope it, so an in-transaction vacuum invalidates the entry without a dedicated hook. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012uKWWwBDt5TWWS5DR2tzDb
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.
Follow-up to #144, design document only.
I checked the call path before writing the piece the plan listed first, and it does not do what the plan assumed. The uniqueness check reaches
columnar_index_fetch_tuplethrough core'stable_index_fetch_tuple_check, which builds a slot, calls the ordinary fetch callback, and throws the slot away. The access method cannot distinguish that from a real fetch, so a needed-columns bitmap cannot help the caller it was aimed at.Reordered: the statement-scoped decoded-group cache goes first, since it helps every caller including the check. Also recorded that
GetCurrentCommandId(false)is enough to scope the cache to a statement, so apgcolumnar.vacuumin the same transaction invalidates it without a dedicated hook.