Skip to content

Commit

Permalink
opt: add partial index lookup join EXPLAIN test
Browse files Browse the repository at this point in the history
This commit adds a test that verifies that the `(partial index)` label
is shown in `EXPLAIN` output when the query plan contains a lookup join
on a partial index.

Release note: None
  • Loading branch information
mgartner committed Dec 23, 2020
1 parent 86949e1 commit b7398e8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkg/sql/opt/exec/execbuilder/testdata/partial_index
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ CREATE TABLE inv (
# EXPLAIN
# ---------------------------------------------------------

# EXPLAIN output shows the partial index label on scans over partial indexes.
# EXPLAIN output shows the partial index label on scans and joins on partial
# indexes.
query T
EXPLAIN SELECT b FROM t WHERE b > 10
----
Expand All @@ -34,6 +35,21 @@ vectorized: true
table: t@b_partial (partial index)
spans: FULL SCAN

query T
EXPLAIN SELECT t1.a FROM t t1 INNER LOOKUP JOIN t t2 ON t1.a = t2.b AND t2.b > 10
----
distribution: local
vectorized: true
·
• lookup join
│ table: t@b_partial (partial index)
│ equality: (a) = (b)
└── • scan
missing stats
table: t@primary
spans: [/11 - ]

query T
EXPLAIN SELECT a FROM inv@i WHERE b @> '{"x": "y"}' AND c IN ('foo', 'bar')
----
Expand Down

0 comments on commit b7398e8

Please sign in to comment.