-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Changes from 51 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
3f551c3
plan, tidb: support plan cache for SELECT statement
zz-jason 7df5dea
plan, tidb: support plan cache for SELECT statement
zz-jason 2a5f0e4
1. add global config for plan cache
zz-jason 921465b
Merge branch 'zz-jason/plancache/lru' of https://github.com/pingcap/t…
zz-jason b869cd3
make check happy
zz-jason 35b0212
Merge branch 'master' of https://github.com/pingcap/tidb into zz-jaso…
zz-jason 1a7737a
remove useless code
zz-jason 62bbd9b
simple name changing
zz-jason 2bed447
simple name changing
zz-jason 2949558
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 7e40f5c
fix ci
zz-jason 8b2cafc
Merge branch 'master' of https://github.com/pingcap/tidb into zz-jaso…
zz-jason ed76506
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 2e79a42
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 10320ea
Merge branch 'master' into zz-jason/plancache/lru
shenli 2fbde7a
Merge branch 'master' of https://github.com/pingcap/tidb into zz-jaso…
zz-jason 0ca06c7
Merge branch 'zz-jason/plancache/lru' of https://github.com/pingcap/t…
zz-jason 171fa18
use sharded lru cache
zz-jason ea8808a
tiny change
zz-jason 1a8aeda
use global plan cache by default
zz-jason f402035
tiny fix
zz-jason fa8e604
code refine
zz-jason efe7e94
Merge branch 'master' into zz-jason/plancache/lru
zz-jason e547abc
make check happy
zz-jason f27991b
fix ci
zz-jason 18c5b81
Merge branch 'master' of https://github.com/pingcap/tidb into zz-jaso…
zz-jason 8cebe6c
fix ci
zz-jason 940fd6c
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 2b307d3
fix data race
zz-jason c43093b
Merge branch 'master' of https://github.com/pingcap/tidb into zz-jaso…
zz-jason 0320ba0
fix data race
zz-jason 66f0fe4
fix ci
zz-jason f0c12fd
code refine
zz-jason 776501b
only create sharded-lru-cache when plan cache enabled
zz-jason e6c2f42
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 7a965ba
address comment
zz-jason 7dc7fe3
remove useless code
zz-jason 0ec3345
address comment
zz-jason 92b43e4
Merge branch 'zz-jason/plancache/lru' of https://github.com/pingcap/t…
zz-jason 48f83b7
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 6d73f7c
fix ci
zz-jason db7d860
Merge branch 'zz-jason/plancache/lru' of https://github.com/pingcap/t…
zz-jason 90aa8ff
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 674280f
close plan cache by default
zz-jason a47d3e9
Merge branch 'zz-jason/plancache/lru' of https://github.com/pingcap/t…
zz-jason 38b8a50
correct misspell
zz-jason 573462a
address comment
zz-jason 8e3b7b5
address comment
zz-jason 4f0a0a4
address comment
zz-jason aeb894d
fix ci
zz-jason bf2ebe6
remove useless code
zz-jason 4461da9
address comment
zz-jason b905610
Merge branch 'master' into zz-jason/plancache/lru
zz-jason 47c57fe
address comment
zz-jason 5406735
disable plancache by default
zz-jason 2ead154
Merge branch 'master' into zz-jason/plancache/lru
zz-jason File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1207,7 +1207,7 @@ func (b *executorBuilder) buildIndexLookUpReader(v *plan.PhysicalIndexLookUpRead | |
tableReaderSchema *expression.Schema | ||
) | ||
table, _ := b.is.TableByID(is.Table.ID) | ||
len := v.Schema().Len() | ||
length := v.Schema().Len() | ||
if v.NeedColHandle { | ||
handleCol = v.Schema().TblID2Handle[is.Table.ID][0] | ||
} else if !is.OutOfOrder { | ||
|
@@ -1219,13 +1219,18 @@ func (b *executorBuilder) buildIndexLookUpReader(v *plan.PhysicalIndexLookUpRead | |
RetType: types.NewFieldType(mysql.TypeLonglong), | ||
} | ||
tableReaderSchema.Append(handleCol) | ||
len = tableReaderSchema.Len() | ||
length = tableReaderSchema.Len() | ||
} | ||
|
||
for i := 0; i < len; i++ { | ||
for i := 0; i < length; i++ { | ||
tableReq.OutputOffsets = append(tableReq.OutputOffsets, uint32(i)) | ||
} | ||
|
||
ranges := make([]*types.IndexRange, 0, len(is.Ranges)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a comment for why clone ranges? |
||
for _, rangeInPlan := range is.Ranges { | ||
ranges = append(ranges, rangeInPlan.Clone()) | ||
} | ||
|
||
e := &IndexLookUpExecutor{ | ||
ctx: b.ctx, | ||
schema: v.Schema(), | ||
|
@@ -1235,7 +1240,7 @@ func (b *executorBuilder) buildIndexLookUpReader(v *plan.PhysicalIndexLookUpRead | |
index: is.Index, | ||
keepOrder: !is.OutOfOrder, | ||
desc: is.Desc, | ||
ranges: is.Ranges, | ||
ranges: ranges, | ||
tableRequest: tableReq, | ||
columns: is.Columns, | ||
handleCol: handleCol, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set default to true is not safe for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only for the ci test, will be disabled in the last commit of this pr