Skip to content

Commit

Permalink
sql: add not visible index to optimizer
Browse files Browse the repository at this point in the history
This commit adds the logic of the invisible index feature to the optimizer.
After this commit has been merged, the invisible index feature should be fully
functional with `CREATE INDEX` and `CREATE TABLE`.

Assists: cockroachdb#72576

See also: cockroachdb#85239

Release note (sql change): creating a not visible index using
`CREATE TABLE …(INDEX … NOT VISIBLE)` or
`CREATE INDEX … NOT VISIBLE` is now supported.
  • Loading branch information
wenyihu6 committed Aug 11, 2022
1 parent fbe4fea commit ef4970f
Show file tree
Hide file tree
Showing 4 changed files with 1,158 additions and 34 deletions.
6 changes: 0 additions & 6 deletions pkg/sql/create_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,6 @@ func (n *createIndexNode) startExec(params runParams) error {
)
}

if n.n.NotVisible {
return unimplemented.Newf(
"Not Visible Index",
"creating a not visible index is not supported yet")
}

// Warn against creating a non-partitioned index on a partitioned table,
// which is undesirable in most cases.
// Avoid the warning if we have PARTITION ALL BY as all indexes will implicitly
Expand Down
10 changes: 0 additions & 10 deletions pkg/sql/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -1777,11 +1777,6 @@ func NewTableDesc(
return nil, pgerror.Newf(pgcode.DuplicateRelation, "duplicate index name: %q", d.Name)
}
}
if d.NotVisible {
return nil, unimplemented.Newf(
"Not Visible Index",
"creating a not visible index is not supported yet")
}
if err := validateColumnsAreAccessible(&desc, d.Columns); err != nil {
return nil, err
}
Expand Down Expand Up @@ -1886,11 +1881,6 @@ func NewTableDesc(
// We will add the unique constraint below.
break
}
if d.NotVisible {
return nil, unimplemented.Newf(
"Not Visible Index",
"creating a not visible index is not supported yet")
}
// If the index is named, ensure that the name is unique. Unnamed
// indexes will be given a unique auto-generated name later on when
// AllocateIDs is called.
Expand Down
Loading

0 comments on commit ef4970f

Please sign in to comment.