Skip to content

Commit

Permalink
sql read stmt use length(c|pad) to avoid network bandwidth limit
Browse files Browse the repository at this point in the history
  • Loading branch information
rockeet committed Oct 10, 2022
1 parent 0e9f058 commit e9ea09f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/lua/oltp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,22 @@ end
local t = sysbench.sql.type
local stmt_defs = {
point_selects = {
"SELECT c FROM sbtest%u WHERE id=?",
"SELECT length(c) FROM sbtest%u WHERE id=?",
t.INT},
simple_ranges = {
"SELECT c FROM sbtest%u WHERE id BETWEEN ? AND ?",
"SELECT length(c) FROM sbtest%u WHERE id BETWEEN ? AND ?",
t.INT, t.INT},
secondary_ranges = {
"SELECT c FROM sbtest%u WHERE k >= ? AND ? >=0 LIMIT %u",
"SELECT length(c) FROM sbtest%u WHERE k >= ? AND ? >=0 LIMIT %u",
t.INT, t.INT},
sum_ranges = {
"SELECT SUM(k) FROM sbtest%u WHERE id BETWEEN ? AND ?",
t.INT, t.INT},
order_ranges = {
"SELECT c FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY c",
"SELECT length(c) as lenc FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY lenc",
t.INT, t.INT},
distinct_ranges = {
"SELECT DISTINCT c FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY c",
"SELECT DISTINCT length(c) as lenc FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY lenc",
t.INT, t.INT},
index_updates = {
"UPDATE sbtest%u SET k=k+1 WHERE id=?",
Expand Down
2 changes: 1 addition & 1 deletion src/lua/select_random_points.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function thread_init()
local points = string.rep("?, ", sysbench.opt.random_points - 1) .. "?"

stmt = con:prepare(string.format([[
SELECT id, k, c, pad
SELECT id, k, length(c), length(pad)
FROM sbtest1
WHERE k IN (%s)
]], points))
Expand Down
2 changes: 1 addition & 1 deletion tests/t/script_oltp_help.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OLTP usage information test
--index_updates=N Number of UPDATE index queries per transaction [1]
--mysql_storage_engine=STRING Storage engine, if MySQL is used [innodb]
--non_index_updates=N Number of UPDATE non-index queries per transaction [1]
--secondary_ranges=N Number of secondary range SELECT queries per transaction [1]
--secondary_ranges=[0|1|2] Secondary index to fetch table SELECT queries per transaction [1]
--order_ranges=N Number of SELECT ORDER BY queries per transaction [1]
--pgsql_variant=STRING Use this PostgreSQL variant when running with the PostgreSQL driver. The only currently supported variant is 'redshift'. When enabled, create_secondary is automatically disabled, and delete_inserts is set to 0
--point_selects=N Number of point SELECT queries per transaction [10]
Expand Down

0 comments on commit e9ea09f

Please sign in to comment.