add a table hint to access table from a specific type of storage.#446
Conversation
Codecov Report
@@ Coverage Diff @@
## master #446 +/- ##
==========================================
+ Coverage 71.61% 71.63% +0.02%
==========================================
Files 32 32
Lines 7736 7735 -1
==========================================
+ Hits 5540 5541 +1
+ Misses 1671 1670 -1
+ Partials 525 524 -1
Continue to review full report at Codecov.
|
|
Product team advised hint |
413f67a to
fc1c96c
Compare
60fdde9 to
c956035
Compare
| case "memory_quota": | ||
| ctx.WritePlainf("%d M", n.MemoryQuota) | ||
| case "read_consistent_storage": | ||
| ctx.WritePlain(n.StoreType.O) |
There was a problem hiding this comment.
| ctx.WritePlain(n.StoreType.O) | |
| ctx.WritePlain(n.StoreType.String()) |
There was a problem hiding this comment.
If we use String(), it may causes TIFLASH ---> `TIFLASH`. Then the SQL hint will like READ_CONSISTENT_STORAGE(`TIFLASH`[`t1`, `t2`]), that's strange.
There was a problem hiding this comment.
Only ctx.WriteName() will add those backquotes. BTW you should use ctx.WriteKeyWord() for case-insensitive keyword-like output.
There was a problem hiding this comment.
OKay. Thanks for your advisement. @kennytm
There was a problem hiding this comment.
??? I'm confused.
func (cis CIStr) String() string {
return cis.O
}There was a problem hiding this comment.
@foreyes My fault. I thought you suggested using the WriteName.
| c.Assert(hints[1].Indexes[0].L, Equals, "c1") | ||
|
|
||
| // Test READ_CONSISTENT_STORAGE | ||
| stmt, _, err = parser.Parse("select /*+ READ_CONSISTENT_STORAGE(tiflash[t1, t2], tikv[t3]) */ c1, c2 from t1, t2, t1 t3 where t1.c1 = t2.c1 and t2.c1 = t3.c1", "", "") |
There was a problem hiding this comment.
Why choose this syntax? Why not READ_CONSISTENT_STORAGE(tiflash t1, t2), READ_CONSISTENT_STORAGE(tikv t3) to be consistent with others?
There was a problem hiding this comment.
Because we can regard a tiflash[t1, t2] as a whole. If the "query block" also exists in this hint, the hint will like READ_CONSISTENT_STORAGE(@sel1 tiflash t1, t2). That's incomprehensible.
There was a problem hiding this comment.
Also seems incomprehensible in this case: READ_CONSISTENT_STORAGE(tiflash[t1, t2], tikv[t3]) ----> READ_CONSISTENT_STORAGE(tiflash t1, t2 tikv t3)
There was a problem hiding this comment.
- I don't have strong opinion on this specific syntax, but if you decided to group similiar things, it is better to change all others that has similiar syntax, like
indexanduse_index_merge. - I think it is quite clear what the comment want to say in
READ_CONSISTENT_STORAGE(@sel1 tiflash t1, t2).
There was a problem hiding this comment.
No, just seperate them into two like READ_CONSISTENT_STORAGE(tiflash t1, t2), READ_CONSISTENT_STORAGE(tikv t3).
There was a problem hiding this comment.
Hmmm...So may I keep this format? The product manager says that we can only focus on functions. The form is under consideration now.
d04052a to
7998b80
Compare
What problem does this PR solve?
At now, tidb need a hint to make table reading from tiflash.
What is changed and how it works?
Add a hint to enforce table reading form tiflash.
Check List
Tests
Related changes