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

plan, tidb: support plan cache for SELECT statement #4644

Merged
merged 56 commits into from Oct 12, 2017

Conversation

Projects
None yet
7 participants
@zz-jason
Member

zz-jason commented Sep 26, 2017

main change:

  1. add a simple lru cache, defined in plan/cache/lru.go
  2. in function func (s *session) Execute(sql string) ([]ast.RecordSet, error), we check the opportunity to use plan cache first
  3. currently, we only add select statement into cache
@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Sep 26, 2017

Member

@zz-jason Good job!
Any benchmark result?

Member

shenli commented Sep 26, 2017

@zz-jason Good job!
Any benchmark result?

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Sep 26, 2017

Member

@shenli WIP, benchmark result will be provided later.

Member

zz-jason commented Sep 26, 2017

@shenli WIP, benchmark result will be provided later.

@zz-jason zz-jason added the status/WIP label Sep 26, 2017

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros

winoros Sep 26, 2017

Member

When transaction changed from read only to not read only. The plan will be changed since dirty table exists.

Member

winoros commented Sep 26, 2017

When transaction changed from read only to not read only. The plan will be changed since dirty table exists.

@zz-jason zz-jason removed the status/WIP label Sep 27, 2017

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Sep 28, 2017

Member

Please fix CI @zz-jason

Member

zimulala commented Sep 28, 2017

Please fix CI @zz-jason

@zz-jason zz-jason added the status/WIP label Sep 28, 2017

zz-jason added some commits Sep 28, 2017

@zz-jason zz-jason removed the status/WIP label Sep 28, 2017

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Oct 11, 2017

Member

/run-all-test

Member

zz-jason commented Oct 11, 2017

/run-all-test

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason
Member

zz-jason commented Oct 11, 2017

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 11, 2017

Contributor

LGTM

Contributor

XuHuaiyu commented Oct 11, 2017

LGTM

)
// Cacheable checks whether the input ast is cacheable.
func Cacheable(node ast.Node) bool {

This comment has been minimized.

@coocood

coocood Oct 11, 2017

Member

Need some test for this function.

@coocood

coocood Oct 11, 2017

Member

Need some test for this function.

This comment has been minimized.

@zz-jason

zz-jason Oct 11, 2017

Member

added

@zz-jason
Show outdated Hide outdated session.go
Show outdated Hide outdated config/config.go
@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Oct 12, 2017

Member

LGTM

Member

coocood commented Oct 12, 2017

LGTM

@coocood coocood merged commit d88344f into master Oct 12, 2017

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
ci/circleci Your tests passed on CircleCI!
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@coocood coocood deleted the zz-jason/plancache/lru branch Oct 12, 2017

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 14, 2017

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 15, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 17, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 19, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 20, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 20, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 20, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 21, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 23, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 24, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Oct 24, 2017

tidb: support a plan cache for prepared statements
      - compile a prepared statement once and reuse the compiled plan
      - only evaluate expression including parameterized ones whenever execute the prepared statement
      - use a LRU cache lib. for storing the plan (#4644)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment