sql: add is_visible to indexes info table#84776
sql: add is_visible to indexes info table#84776craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
The first commit comes from #84763. Update: the first commit has been merged into master. This branch is now rebased on master. |
076a1bb to
3eedca5
Compare
b7a76c9 to
21c6230
Compare
6300c57 to
7870847
Compare
mgartner
left a comment
There was a problem hiding this comment.
Great job! Just a couple questions.
Reviewed 26 of 26 files at r2, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @wenyihu6)
pkg/sql/delegate/show_database_indexes.go line 58 at r2 (raw file):
getAllIndexesQuery += ` ORDER BY 1, 2, 4`
Can you explain why you added this?
pkg/sql/logictest/testdata/logic_test/storing line 14 at r2 (raw file):
SHOW INDEXES FROM t ---- table_name index_name non_unique seq_in_index column_name direction storing implicit visible
Do we need to add the visible column here? visible is an attribute of the entire index, not indexed columns. We don't include other attributes of indexes such as an inverted bool, a partial index predicate. Did we forget to add those or is there a reason we didn't? cc @cockroachdb/sql-experience
This PR adds a new field `NotVisible` to the struct `IndexDescriptor`. Since primary indexes cannot be not visible, it also includes another check in `pkg/sql/catalog/tabledesc/validate.go`. Since the invisible index feature has not been introduced yet, all indexes created should be visible. See also: cockroachdb#84776 Assists: cockroachdb#72576 Release note: none
|
Previously, mgartner (Marcus Gartner) wrote…
I think this will make the result more deterministic. Having the result sorted by |
7870847 to
7e4fbc2
Compare
michae2
left a comment
There was a problem hiding this comment.
Reviewed 26 of 26 files at r2, all commit messages.
Reviewable status:complete! 2 of 0 LGTMs obtained (waiting on @mgartner, @michae2, and @wenyihu6)
pkg/sql/delegate/show_database_indexes.go line 58 at r2 (raw file):
Previously, mgartner (Marcus Gartner) wrote…
Can you explain why you added this?
I asked Wenyi to add this (here). It makes the SHOW output deterministic, which makes it more compatible with MySQL / MariaDB SHOW output. Most of our other SHOW commands also have explicit ordering.
pkg/sql/logictest/testdata/logic_test/storing line 14 at r2 (raw file):
Previously, mgartner (Marcus Gartner) wrote…
Do we need to add the
visiblecolumn here?visibleis an attribute of the entire index, not indexed columns. We don't include other attributes of indexes such as an inverted bool, a partial index predicate. Did we forget to add those or is there a reason we didn't? cc @cockroachdb/sql-experience
We're trying to match the output of MySQL SHOW INDEXES.
This PR adds parsing support for `CREATE INDEX … NOT VISIBLE` and `CREATE TABLE (... INDEX() NOT VISIBLE)`. This PR does not add any logic to the optimizer, and executing it returns an “unimplemented” error immediately. Assists: cockroachdb#72576 See also: cockroachdb#84776 Release note (sql change): Parser now supports creating an index with the option to mark them as invisible. But no implementation has done yet, and executing it returns an “unimplemented” error immediately.
This commit adds a new field `NotVisible` to the struct `IndexDescriptor`. Since primary indexes cannot be not visible, it also includes another check in `pkg/sql/catalog/tabledesc/validate.go`. Since the invisible index feature has not been introduced yet, all indexes created should be visible. See also: cockroachdb#84776 Assists: cockroachdb#72576 Release note: none
84763: sql: add NotVisible to index descriptor r=wenyihu6 a=wenyihu6 This commit adds a new field `NotVisible` to the struct `IndexDescriptor`. Since primary indexes cannot be not visible, it also includes another check in `pkg/sql/catalog/tabledesc/validate.go`. Since the invisible index feature has not been introduced yet, all indexes created should be visible. See also: #84776 Assists: #72576 Release note: none Co-authored-by: wenyihu3 <wenyi.hu@cockroachlabs.com>
mgartner
left a comment
There was a problem hiding this comment.
Reviewed 19 of 26 files at r4, 32 of 32 files at r5, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @michae2 and @wenyihu6)
pkg/sql/delegate/show_database_indexes.go line 58 at r2 (raw file):
Previously, michae2 (Michael Erickson) wrote…
I asked Wenyi to add this (here). It makes the
SHOWoutput deterministic, which makes it more compatible with MySQL / MariaDBSHOWoutput. Most of our otherSHOWcommands also have explicit ordering.
Thanks for the explanation!
pkg/sql/logictest/testdata/logic_test/storing line 14 at r2 (raw file):
Previously, michae2 (Michael Erickson) wrote…
We're trying to match the output of MySQL
SHOW INDEXES.
Got it. Thanks!
b550060 to
f1b31eb
Compare
f1b31eb to
56b25b5
Compare
This PR adds parsing support for `CREATE INDEX … NOT VISIBLE` and `CREATE TABLE (... INDEX() NOT VISIBLE)`. This PR does not add any logic to the optimizer, and executing it returns an “unimplemented” error immediately. Assists: cockroachdb#72576 See also: cockroachdb#84776 Release note (sql change): Parser now supports creating an index with the option to mark them as invisible. But no implementation has done yet, and executing it returns an “unimplemented” error immediately.
5c18231 to
e3832ef
Compare
|
bors r+ |
|
Build failed (retrying...): |
|
Let's try this again. bors r+ |
|
Already running a review |
|
bors r- |
|
Canceled. |
|
bors r+ |
|
Build failed (retrying...): |
|
Build failed (retrying...): |
This commit adds a new column `is_visible` to `crdb_internal.table_indexes` and `information_schema.statistics`. It also adds a new column `visible` to the output of following SQL statements: ``` SHOW INDEX FROM (table_name) SHOW INDEXES FROM (table_name) SHOW KEYS FROM (table_name) SHOW INDEX FROM DATABASE (database_name) SHOW INDEXES FROM DATABASE (database_name) SHOW KEYS FROM DATABASE (database_name) ``` Since the not visible index feature has not been introduced yet, it is expected for all test cases to output `true` for all `is_visible` or `visible` columns. Assists: cockroachdb#72576 See also: cockroachdb#84783 Release note (sql change): A new column `is_visible` has been added to the table `crdb_internal.table_indexes` and `information_schema.statistics`. A new column `visible` has also been added to the output of `SHOW INDEX`, `SHOW INDEXES`, and `SHOW KEYS`. The `is_visible` or `visible` column indicates whether the index is visible to the optimizer.
e3832ef to
9e6ab9d
Compare
|
Canceled. |
|
bors r+ |
|
Build succeeded: |
This commit adds a new column
is_visibletocrdb_internal.table_indexesandinformation_schema.statistics. It also adds a new columnvisibleto theoutput of following SQL statements:
Since the not visible index feature has not been introduced yet, it is expected
for all test cases to output
truefor allis_visibleorvisiblecolumns.Assists: #72576, #84357
See also: #84783
Release note (sql change): A new column
is_visiblehas been added to the tablecrdb_internal.table_indexesandinformation_schema.statistics. A new columnvisiblehas also been added to the output ofSHOW INDEX,SHOW INDEXES, andSHOW KEYS. Theis_visibleorvisiblecolumn indicates whether the index isvisible to the optimizer.