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

ddl: enable hash partition and range columns partition by default #9936

Merged
merged 5 commits into from
May 8, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ func buildTablePartitionInfo(ctx sessionctx.Context, d *ddl, s *ast.CreateTableS
enable = false
default:
// When tidb_enable_table_partition = 'auto',
// Partition by range expression is enabled by default.
if s.Partition.Tp == model.PartitionTypeRange && s.Partition.ColumnNames == nil {
if s.Partition.Tp == model.PartitionTypeRange {
// Partition by range expression is enabled by default.
if s.Partition.ColumnNames == nil {
enable = true
}
// Partition by range columns and just one column.
if len(s.Partition.ColumnNames) == 1 {
enable = true
}
}
// Partition by hash is enabled by default.
// Note that linear hash is not enabled.
if s.Partition.Tp == model.PartitionTypeHash {
enable = true
}
}
Expand Down