opt: don't apply disallow_full_table_scans to internal executors #137961
+11
−1
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.
We have various checks for disallow_full_table_scans:
We don't want disallow_full_table_scans to apply to anything done by internal executors. (1) was already checking whether this connExecutor was internal. (2) and (3) were not, which led to #137404. #137681 fixed this by setting disallow_full_table_scans in
NewInternalSessionData
, but we only useNewInternalSessionData
for some uses of the internal executor.This commit explicitly checks
SessionData().Internal
in (2) and (3) to match (1), so that we don't get any of the disallow_full_table_scans behavior for any use of the internal executor, including populating virtual tables.This commit also adds
SessionData().Internal
to the memo staleness check.This behavior can be observed with the following diff, which adds an index hint to the
crdb_internal.system_jobs
virtual table SQL:With this diff, the following SQL hits (2) and fails with an error, even though it uses the internal executor and thus should not error:
With this commit we no longer fail, matching the behavior without the index hint.
Informs: #137404
Informs: #123783
Release note: None