Skip to content
Merged
Changes from all 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
6 changes: 3 additions & 3 deletions partitioned-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ The optimizer can prune partitions through `WHERE` conditions in the following t
create table t (id int) partition by range (id) (
partition p0 values less than (5),
partition p1 values less than (10));
select * from t where t > 6;
select * from t where id > 6;
```

Or the partition expression is in the form of `fn(col)` where `fn` is `to_days`:
Expand All @@ -810,7 +810,7 @@ The optimizer can prune partitions through `WHERE` conditions in the following t
create table t (dt datetime) partition by range (to_days(id)) (
partition p0 values less than (to_days('2020-04-01')),
partition p1 values less than (to_days('2020-05-01')));
select * from t where t > '2020-04-18';
select * from t where dt > '2020-04-18';
```

An exception is `floor(unix_timestamp())` as the partition expression. TiDB does some optimization for that case by case, so it is supported by partition pruning.
Expand All @@ -822,7 +822,7 @@ The optimizer can prune partitions through `WHERE` conditions in the following t
partition by range (floor(unix_timestamp(ts))) (
partition p0 values less than (unix_timestamp('2020-04-01 00:00:00')),
partition p1 values less than (unix_timestamp('2020-05-01 00:00:00')));
select * from t where t > '2020-04-18 02:00:42.123';
select * from t where ts > '2020-04-18 02:00:42.123';
```

## Partition selection
Expand Down