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

enhance partition pruning for table partition #7516

Closed
tiancaiamao opened this issue Aug 28, 2018 · 6 comments
Closed

enhance partition pruning for table partition #7516

tiancaiamao opened this issue Aug 28, 2018 · 6 comments
Assignees
Labels

Comments

@tiancaiamao
Copy link
Contributor

There are two known issues for current partition pruning implementation:

  1. it doesn't support filter conditions that can't be push down to datasource
  2. it doesn't support expressions that can't calculate range

Both of them are not reasonable.

@coocood advised in #6642 to ignore the selection node above datasoure node, so filter conditions that can't be push down to datasource won't be considered by partition pruning function, that's why limitation 1 exists.

Suppose we haven't implement timestamp type in TiKV yet, the filter condition will not be pushed down to datasource, then partition pruning can't work on this example:

select ts from t where ts > 20060308110502

Limitation 2 comes from the fact that we currently use range calculation to implement partition pruning.

create table t (id int) partition by range (to_days(id)) ...
select * from t where id > 2018-03-08

to_days is a function, we can't calculate range for it, so partition pruning can't work.

@winoros
Copy link
Member

winoros commented Aug 28, 2018

This is also the limitation the non-partitioned table have when calculating range.

@tiancaiamao
Copy link
Contributor Author

A demo for it https://gist.github.com/tiancaiamao/4aab62ba70381fce15da1e4572fbd0b1

@morgo
Copy link
Contributor

morgo commented Sep 5, 2018

In #7523 I have a small feature request which complements test-cases for partition pruning.

@tiancaiamao
Copy link
Contributor Author

I have already make partition info visible in this PR:
https://github.com/pingcap/tidb/pull/7505/files#diff-0d9c730193ced8057a092d0c770ea44fR28

There is a lot of room for improvement, any suggestion is welcome. @morgo

@tiancaiamao
Copy link
Contributor Author

PR #7643 has been merged.
I'll update this issue soon.

@nanne007
Copy link
Contributor

nanne007 commented Dec 3, 2018

Awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants