Skip to content
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

UCP: Support Invisible Indexes #9246

Closed
shenli opened this issue Feb 2, 2019 · 5 comments · Fixed by #16914
Closed

UCP: Support Invisible Indexes #9246

shenli opened this issue Feb 2, 2019 · 5 comments · Fixed by #16914
Assignees
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/P0 The issue has P0 priority. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.
Milestone

Comments

@shenli
Copy link
Member

shenli commented Feb 2, 2019

Description

MySQL supports invisible indexes; that is, indexes that are not used by the optimizer.

This is a useful feature when you want to drop an index in a safe way. Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. Dropping and re-adding an index can be expensive for a large table, whereas making it invisible and visible are fast, in-place operations.

Support the option of VISIBLE | INVISIBLE.

CREATE [...] INDEX index_name
    [index_type]
    ON tbl_name (key_part,...)
    [index_option]

index_option:
    {VISIBLE | INVISIBLE}

Also, consider the following:

  • Display information about invisible indexes in the output of INFORMATION_SCHEMA.STATISTICS or SHOW INDEX.
  • Index hints need to report errors when used in invisible indexes.
  • The primary key cannot be set to an invisible index.

Score

  • 1294

Mentor(s)

Contact the mentors: #tidb-challenge-program channel in TiDB Community Slack Workspace

Recommended Skills

  • DDL
  • Golang

Learning Materials

MySQL's document for syntax reference.
TiDB DDL architecture

Time

GanttStart: 2020-07-10
GanttDue: 2020-08-15
GanttProgress: 100%

@morgo
Copy link
Contributor

morgo commented Feb 8, 2019

Note that MySQL 8.0 will likely support INVISIBLE columns in the future as well. We can tell this because functional indexes in 8.0 are based on virtual columns + invisible columns.

The semantics behind INVISIBLE columns are harder than invisible indexes, but assuming they are added to MySQL, we should plan on adding this feature too.

@shenli
Copy link
Member Author

shenli commented Feb 12, 2019

@morgo We will discuss it.
/cc @winkyao https://mariadb.com/kb/en/library/invisible-columns/ FYI

@SunRunAway
Copy link
Contributor

Will this feature be appended into 4.0?

@zimulala zimulala added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. difficulty/hard and removed difficulty/hard labels Feb 28, 2020
@zz-jason zz-jason changed the title Support Invisible Indexes PCP: Support Invisible Indexes Feb 28, 2020
@zz-jason zz-jason changed the title PCP: Support Invisible Indexes UCP: Support Invisible Indexes Feb 28, 2020
@zimulala zimulala added sig/sql-infra SIG: SQL Infra and removed component/DDL1 labels Mar 4, 2020
@Deardrops
Copy link
Contributor

Let me implement this feature.

@bb7133 bb7133 modified the milestones: v5.0.0-alpha.1, v5.0.0-alpha Jul 14, 2020
@bb7133 bb7133 added priority/P0 The issue has P0 priority. and removed priority/P1 The issue has P1 priority. labels Jul 17, 2020
@zimulala
Copy link
Contributor

This feature needs to be tested more systematically, reopen this issue to facilitate tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/P0 The issue has P0 priority. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.