-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: add is_visible to indexes info table #84776
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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
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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
SHOW
output deterministic, which makes it more compatible with MySQL / MariaDBSHOW
output. Most of our otherSHOW
commands 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_visible
tocrdb_internal.table_indexes
andinformation_schema.statistics
. It also adds a new columnvisible
to 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
true
for allis_visible
orvisible
columns.Assists: #72576, #84357
See also: #84783
Release note (sql change): A new column
is_visible
has been added to the tablecrdb_internal.table_indexes
andinformation_schema.statistics
. A new columnvisible
has also been added to the output ofSHOW INDEX
,SHOW INDEXES
, andSHOW KEYS
. Theis_visible
orvisible
column indicates whether the index isvisible to the optimizer.