Repository navigation
Cover indexes on unnested record types with several unnestings and other definitions in yaml-tests - #4870
Conversation
f9e184a to
6f0d71f
Compare
23fc442 to
37d978f
Compare
0cc09aa to
d70cbc2
Compare
Covers sibling unnestings, the same array unnested twice, and an unnesting nested in another one. The index on the nested unnesting is not matched yet, which the tests document.
…amsql The file now covers indexes on unnested record types with one unnesting and with several, so the separate file and its registration are dropped.
…s in unnested-record-type-indexes.yamsql Adds an index over a view, DESC and NULLS LAST ordering, a value column with a composite primary key and an ARRAY NOT NULL column, a struct array mixed with a scalar array, three sibling arrays, chained unnestings, and the index definitions that an unnested synthetic table rejects. The indexes over a struct and a scalar array, and over chained unnestings, are not matched yet, which the tests document.
…t access The collection a nested constituent explodes was built as a field access on top of the owner's element, (q._0).inner, while a query navigating the same unnestings writes it as a single field access, q._0.inner. The two values do not compare equal, so the explodes, and with them indexes over chained unnestings, were never matched.
…ynthetic type The key of an index on a synthetic type is expanded over a temporary base quantifier that does not survive the merge with the base expansion. Predicates and placeholders were re-expressed over the base record, but the graphs of the key's quantifiers were not, so the explode of a scalar array fanned out in the key kept explode(base.parent.labels), correlated to the dropped quantifier, and could not match the explode(parent.labels) of a query.
… array to be used The queries over chained unnestings now use covering scans of their indexes. The index over a struct array and a scalar array answers queries that only join the scalar array or bind its element by an equality; returning or ordering by the element is not supported, as with a fan-out index on a stored type (#4871).
Adds queries over the indexes on `trip`, `team` and `chain` that read a column held by the synthetic record but not by the index key, so the index entries are fetched rather than covering the query. Also condenses the header of the file into one list of the tables and what each covers, and regenerates the metrics so that their references point at the shifted lines.
…cord-type-indexes.yamsql Removes the LESS_THAN variants of two mv_split range tests, which only flip the comparison of the tests before them, and the equality on the leading column of trip_place_city_rider_mins, which the test binding the whole key prefix subsumes. Regenerates the metrics for the shifted lines.
37d978f to
d3d906f
Compare
d70cbc2 to
f91a614
Compare
📊 Metrics Diff Analysis ReportSummary
ℹ️ About this analysisThis automated analysis compares query planner metrics between the base branch and this PR. It categorizes changes into:
The last category in particular may indicate planner regressions that should be investigated. New QueriesCount of new queries by file:
Plan and Metrics ChangedThese queries experienced both plan and metrics changes. This generally indicates that there was some planner change Total: 11 queries Statistical Summary (Plan and Metrics Changed)
There were no queries with significant regressions detected. Minor Changes (Plan and Metrics Changed)In addition, there were 11 queries with minor changes. Only Metrics ChangedThese queries experienced only metrics changes without any plan changes. If these metrics have substantially changed, Total: 4 queries Statistical Summary (Only Metrics Changed)
There were no queries with significant regressions detected. Minor Changes (Only Metrics Changed)In addition, there were 4 queries with minor changes. |
Extends
unnested-record-type-indexes.yamsql, which so far tests indexes with a single unnesting, so that it also covers the index definitions of the relational DDL tests (UnnestedSyntheticTableIndexTest) with queries, and fixes two cases in which such an index was never matched.Fixes:
(q._0).innerrather thanq._0.inner, as a query writes it, so the explodes never compared equal (UnnestedRecordType.constituentQuantifier).mergeWithBaseIfNeededre-expressed the key's predicates and placeholders over the base record but not the graphs of its quantifiers, leavingexplode(base.parent.labels)correlated to a dropped quantifier (ValueIndexExpansionVisitor).Tests: indexes over sibling, repeated, nested and chained unnestings, and over a view,
DESC/NULLS LASTkeys and a value column; queries scan the index (covering, orISCANwhen a column must be fetched). An index over a struct array and a scalar array is used only when the scalar element is not returned (#4871).Rejected definitions (
unsupported-index-definitions,UNSUPPORTED_OPERATION): an aggregate, a predicate, the row version, a computed column, a scalar array at two key positions, and an unnesting combined with a join.For each shape, a query that unnests fewer arrays than the index does not use it, as the index has an entry per combination of elements (and none for a row with an empty array).
Two existing
mv_splitrange queries that only flip the comparison of another are dropped; the other existing queries keep their expectations, and their metrics only move to new line numbers. The metrics of the grouped PartiQL query that #4641 commented out are dropped.Stacked on #4641.