Skip to content

Commit

Permalink
select_random_ranges: add secondary_ranges == 3 for mysql mrr range_s…
Browse files Browse the repository at this point in the history
…ize rows
  • Loading branch information
rockeet committed Nov 1, 2023
1 parent 0f10d07 commit 488a0dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lua/select_random_ranges.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ function thread_init()
SELECT count(*), sum(length(c)) FROM sbtest1 WHERE id IN
(SELECT * FROM (SELECT id FROM sbtest1 WHERE %s LIMIT %d) as t)]],
ranges, sysbench.opt.range_size))
elseif (sysbench.opt.secondary_ranges == 3) then
-- MySQL does not generate MRR query plan for secondary_ranges == 2,
-- We add secondary_ranges == 3 as the query for get range_size rows
-- by MRR, secondary_ranges == 1 likely get more rows than range_size.
stmt = con:prepare(string.format([[
SELECT length(c)
FROM sbtest1
WHERE %s LIMIT %d]], ranges, sysbench.opt.range_size))
else
stmt = con:prepare(string.format([[
SELECT sum(length(c))
Expand Down

0 comments on commit 488a0dd

Please sign in to comment.