Commit fdc039db authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28540 Deprecate and ignore the parameter innodb_prefix_index_cluster_optimization

The parameter innodb_prefix_index_cluster_optimization used to enable an
optimization that was added in cb37c557
and was disabled by default.

We will unconditionally enable the extension and mark the parameter
as deprecated.

Related to this, the counters
Innodb_secondary_index_triggered_cluster_reads and
Innodb_secondary_index_triggered_cluster_reads_avoided
allowed to determine the usefulness of this optimization.

Now that the configuration parameter is disabled, the counters
do not serve any useful purpose and can be removed.

row_search_with_covering_prefix(): Fix a bug that caused an
incorrect result to be returned.
parent 0dab74ff
SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value
innodb_prefix_index_cluster_optimization ON
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent; SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF; SET GLOBAL innodb_stats_persistent = OFF;
# Create a table with a large varchar field that we index the prefix # Create a table with a large varchar field that we index the prefix
...@@ -31,110 +26,39 @@ id fake_id bigfield ...@@ -31,110 +26,39 @@ id fake_id bigfield
32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
128 1128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 128 1128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
# Baseline sanity check: 0, 0.
select "no-op query";
no-op query
no-op query
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible for optimization. # Eligible for optimization.
select id, bigfield from prefixinno where bigfield = repeat('d', 31); select id, bigfield from prefixinno where bigfield = repeat('d', 31);
id bigfield id bigfield
31 ddddddddddddddddddddddddddddddd 31 ddddddddddddddddddddddddddddddd
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Eligible for optimization, access via fake_id only. # Eligible for optimization, access via fake_id only.
select id, bigfield from prefixinno where fake_id = 1031; select id, bigfield from prefixinno where fake_id = 1031;
id bigfield id bigfield
31 ddddddddddddddddddddddddddddddd 31 ddddddddddddddddddddddddddddddd
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible for optimization, access via fake_id of big row. # Not eligible for optimization, access via fake_id of big row.
select id, bigfield from prefixinno where fake_id = 1033; select id, bigfield from prefixinno where fake_id = 1033;
id bigfield id bigfield
33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible for optimization. # Not eligible for optimization.
select id, bigfield from prefixinno where bigfield = repeat('x', 32); select id, bigfield from prefixinno where bigfield = repeat('x', 32);
id bigfield id bigfield
32 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 32 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible for optimization.
select id, bigfield from prefixinno where bigfield = repeat('y', 33); select id, bigfield from prefixinno where bigfield = repeat('y', 33);
id bigfield id bigfield
33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible, should not increment lookup counter.
select id, bigfield from prefixinno where bigfield = repeat('b', 8); select id, bigfield from prefixinno where bigfield = repeat('b', 8);
id bigfield id bigfield
8 bbbbbbbb 8 bbbbbbbb
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Eligible, should not increment lookup counter.
select id, bigfield from prefixinno where bigfield = repeat('c', 24); select id, bigfield from prefixinno where bigfield = repeat('c', 24);
id bigfield id bigfield
24 cccccccccccccccccccccccc 24 cccccccccccccccccccccccc
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Should increment lookup counter.
select id, bigfield from prefixinno where bigfield = repeat('z', 128); select id, bigfield from prefixinno where bigfield = repeat('z', 128);
id bigfield id bigfield
128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Disable optimization, confirm we still increment counter.
set global innodb_prefix_index_cluster_optimization = OFF;
select id, bigfield from prefixinno where fake_id = 1033; select id, bigfield from prefixinno where fake_id = 1033;
id bigfield id bigfield
33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
drop table prefixinno; drop table prefixinno;
# Multi-byte handling case # Multi-byte handling case
set global innodb_prefix_index_cluster_optimization = ON;
SET NAMES utf8mb4; SET NAMES utf8mb4;
CREATE TABLE t1( CREATE TABLE t1(
f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN, f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN,
...@@ -146,113 +70,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); ...@@ -146,113 +70,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
f1 f1
a a
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
f1 f1
cccc cccc
cčc cčc
select @cluster_lookups;
@cluster_lookups
3
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
f1 f1
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
f1 f1
தமிழ் தமிழ்
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
f1 f1
ggᵷg ggᵷg
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
f1 f1
😊me 😊me
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
f1 f1
ls¢ ls¢
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%';
f1 f1
¢¢ ¢¢
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
f1 f1
🐱🌑 🐱🌑
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
f1 f1
🌑 🌑
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
2
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
f1 f1
🌒 🌒
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
2
DROP TABLE t1; DROP TABLE t1;
# Multi-byte with minimum character length > 1 bytes # Multi-byte with minimum character length > 1 bytes
CREATE TABLE t1( CREATE TABLE t1(
...@@ -265,113 +123,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); ...@@ -265,113 +123,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
f1 f1
a a
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
f1 f1
cccc cccc
cčc cčc
select @cluster_lookups;
@cluster_lookups
3
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
f1 f1
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
f1 f1
தமிழ் தமிழ்
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
f1 f1
ggᵷg ggᵷg
select @cluster_lookups;
@cluster_lookups
2
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
f1 f1
😊me 😊me
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Not eligible - record length longer than prefix length # Not eligible - record length longer than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
f1 f1
ls¢ ls¢
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%'; SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%';
f1 f1
¢¢ ¢¢
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Eligible - record length shorter than prefix length # Eligible - record length shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
f1 f1
🐱🌑 🐱🌑
select @cluster_lookups;
@cluster_lookups
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Eligible - record length is shorter than prefix length # Eligible - record length is shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
f1 f1
🌑 🌑
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
2
# Eligible - record length is shorter than prefix length # Eligible - record length is shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
f1 f1
🌒 🌒
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
col1 INT, col1 INT,
...@@ -383,22 +175,10 @@ INSERT INTO t1(col1) VALUES(1); ...@@ -383,22 +175,10 @@ INSERT INTO t1(col1) VALUES(1);
SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL; SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL;
col1 col1
1 1
select @cluster_lookups;
@cluster_lookups
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
# Not eligible - record length longer than prefix index # Not eligible - record length longer than prefix index
SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%'; SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%';
col1 col1
3 3
select @cluster_lookups;
@cluster_lookups
2
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-20464 Division by 0 in row_search_with_covering_prefix() # MDEV-20464 Division by 0 in row_search_with_covering_prefix()
...@@ -443,18 +223,10 @@ INSERT INTO wp_blogs (domain, path) VALUES ...@@ -443,18 +223,10 @@ INSERT INTO wp_blogs (domain, path) VALUES
('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'), ('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'),
('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'), ('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar'); ('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
SET GLOBAL innodb_prefix_index_cluster_optimization=off;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
blog_id
2
1
SET GLOBAL innodb_prefix_index_cluster_optimization=on;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no') SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' ); AND path IN ( '/fondsinvesteringer/', '/' );
blog_id blog_id
2 2
1 1
DROP TABLE wp_blogs; DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent; SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent;
-- source include/have_innodb.inc -- source include/have_innodb.inc
SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent; SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF; SET GLOBAL innodb_stats_persistent = OFF;
...@@ -28,185 +24,28 @@ insert into prefixinno values (1, 1001, repeat('a', 1)), ...@@ -28,185 +24,28 @@ insert into prefixinno values (1, 1001, repeat('a', 1)),
select * from prefixinno; select * from prefixinno;
let $show_count_statement = show status like 'innodb_secondary_index_triggered_cluster_reads';
let $show_opt_statement = show status like 'innodb_secondary_index_triggered_cluster_reads_avoided';
--echo # Baseline sanity check: 0, 0.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select "no-op query";
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible for optimization. --echo # Eligible for optimization.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('d', 31); select id, bigfield from prefixinno where bigfield = repeat('d', 31);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible for optimization, access via fake_id only. --echo # Eligible for optimization, access via fake_id only.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where fake_id = 1031; select id, bigfield from prefixinno where fake_id = 1031;
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible for optimization, access via fake_id of big row. --echo # Not eligible for optimization, access via fake_id of big row.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where fake_id = 1033; select id, bigfield from prefixinno where fake_id = 1033;
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible for optimization. --echo # Not eligible for optimization.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('x', 32); select id, bigfield from prefixinno where bigfield = repeat('x', 32);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible for optimization.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('y', 33); select id, bigfield from prefixinno where bigfield = repeat('y', 33);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible, should not increment lookup counter.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('b', 8); select id, bigfield from prefixinno where bigfield = repeat('b', 8);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible, should not increment lookup counter.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('c', 24); select id, bigfield from prefixinno where bigfield = repeat('c', 24);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Should increment lookup counter.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
select id, bigfield from prefixinno where bigfield = repeat('z', 128); select id, bigfield from prefixinno where bigfield = repeat('z', 128);
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Disable optimization, confirm we still increment counter.
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
set global innodb_prefix_index_cluster_optimization = OFF;
select id, bigfield from prefixinno where fake_id = 1033; select id, bigfield from prefixinno where fake_id = 1033;
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval select $count - $base_count into @cluster_lookups;
eval select $opt - $base_opt into @cluster_lookups_avoided;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
drop table prefixinno; drop table prefixinno;
--echo # Multi-byte handling case --echo # Multi-byte handling case
set global innodb_prefix_index_cluster_optimization = ON;
SET NAMES utf8mb4; SET NAMES utf8mb4;
CREATE TABLE t1( CREATE TABLE t1(
f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN, f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN,
...@@ -217,200 +56,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑'); ...@@ -217,200 +56,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑');
INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
--echo # Eligible - record length is shorter than prefix --echo # Eligible - record length is shorter than prefix
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
DROP TABLE t1; DROP TABLE t1;
--echo # Multi-byte with minimum character length > 1 bytes --echo # Multi-byte with minimum character length > 1 bytes
...@@ -424,201 +101,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑'); ...@@ -424,201 +101,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑');
INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
--echo # Eligible - record length is shorter than prefix --echo # Eligible - record length is shorter than prefix
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix length --echo # Not eligible - record length longer than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%'; SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length shorter than prefix length --echo # Eligible - record length shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length is shorter than prefix length --echo # Eligible - record length is shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Eligible - record length is shorter than prefix length --echo # Eligible - record length is shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
...@@ -629,41 +143,11 @@ INSERT INTO t1 VALUES (2, 'test'), (3, repeat('test1', 2000)); ...@@ -629,41 +143,11 @@ INSERT INTO t1 VALUES (2, 'test'), (3, repeat('test1', 2000));
INSERT INTO t1(col1) VALUES(1); INSERT INTO t1(col1) VALUES(1);
--echo # Eligible - record length is shorter than prefix length --echo # Eligible - record length is shorter than prefix length
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL; SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL;
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
--echo # Not eligible - record length longer than prefix index --echo # Not eligible - record length longer than prefix index
let $base_count = query_get_value($show_count_statement, Value, 1);
let $base_opt = query_get_value($show_opt_statement, Value, 1);
SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%'; SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%';
let $count = query_get_value($show_count_statement, Value, 1);
let $opt = query_get_value($show_opt_statement, Value, 1);
--disable_query_log
eval set @cluster_lookups = $count - $base_count;
eval set @cluster_lookups_avoided = $opt - $base_opt;
--enable_query_log
select @cluster_lookups;
select @cluster_lookups_avoided;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
...@@ -709,15 +193,9 @@ INSERT INTO wp_blogs (domain, path) VALUES ...@@ -709,15 +193,9 @@ INSERT INTO wp_blogs (domain, path) VALUES
('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'), ('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar'); ('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
SET GLOBAL innodb_prefix_index_cluster_optimization=off;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
SET GLOBAL innodb_prefix_index_cluster_optimization=on;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no') SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' ); AND path IN ( '/fondsinvesteringer/', '/' );
DROP TABLE wp_blogs; DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent; SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent;
...@@ -70,8 +70,6 @@ buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N ...@@ -70,8 +70,6 @@ buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N
buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created)
buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written)
buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read)
buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read
buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read
buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads) buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads)
buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written) buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written)
buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch
......
...@@ -98,8 +98,6 @@ INNODB_INSTANT_ALTER_COLUMN ...@@ -98,8 +98,6 @@ INNODB_INSTANT_ALTER_COLUMN
INNODB_ONLINEDDL_ROWLOG_ROWS INNODB_ONLINEDDL_ROWLOG_ROWS
INNODB_ONLINEDDL_ROWLOG_PCT_USED INNODB_ONLINEDDL_ROWLOG_PCT_USED
INNODB_ONLINEDDL_PCT_PROGRESS INNODB_ONLINEDDL_PCT_PROGRESS
INNODB_SECONDARY_INDEX_TRIGGERED_CLUSTER_READS
INNODB_SECONDARY_INDEX_TRIGGERED_CLUSTER_READS_AVOIDED
INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_CACHE INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_CACHE
INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_DISK INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_DISK
INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED
......
...@@ -36,8 +36,6 @@ buffer_pool_pages_free disabled ...@@ -36,8 +36,6 @@ buffer_pool_pages_free disabled
buffer_pages_created disabled buffer_pages_created disabled
buffer_pages_written disabled buffer_pages_written disabled
buffer_pages_read disabled buffer_pages_read disabled
buffer_index_sec_rec_cluster_reads disabled
buffer_index_sec_rec_cluster_reads_avoided disabled
buffer_data_reads disabled buffer_data_reads disabled
buffer_data_written disabled buffer_data_written disabled
buffer_flush_batch_scanned disabled buffer_flush_batch_scanned disabled
......
SET @start_global_value = @@global.innodb_prefix_index_cluster_optimization;
SELECT @start_global_value;
@start_global_value
0
#
# exists as global only
#
Valid values are 'ON' and 'OFF'
select @@global.innodb_prefix_index_cluster_optimization in (0, 1);
@@global.innodb_prefix_index_cluster_optimization in (0, 1)
1
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
0
select @@session.innodb_prefix_index_cluster_optimization;
ERROR HY000: Variable 'innodb_prefix_index_cluster_optimization' is a GLOBAL variable
show global variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value
innodb_prefix_index_cluster_optimization OFF
show session variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value
innodb_prefix_index_cluster_optimization OFF
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
#
# show that it's writable
#
set global innodb_prefix_index_cluster_optimization = 'OFF';
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
0
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
set @@global.innodb_prefix_index_cluster_optimization = 'ON';
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
1
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
set global innodb_prefix_index_cluster_optimization = 0;
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
0
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION OFF
set @@global.innodb_prefix_index_cluster_optimization = 1;
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
1
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
set session innodb_prefix_index_cluster_optimization = 'OFF';
ERROR HY000: Variable 'innodb_prefix_index_cluster_optimization' is a GLOBAL variable and should be set with SET GLOBAL
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
1
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
set @@session.innodb_prefix_index_cluster_optimization = 'ON';
ERROR HY000: Variable 'innodb_prefix_index_cluster_optimization' is a GLOBAL variable and should be set with SET GLOBAL
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
1
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
#
# incorrect types
#
set global innodb_prefix_index_cluster_optimization = 1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_prefix_index_cluster_optimization'
set global innodb_prefix_index_cluster_optimization = 1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_prefix_index_cluster_optimization'
set global innodb_prefix_index_cluster_optimization = 2;
ERROR 42000: Variable 'innodb_prefix_index_cluster_optimization' can't be set to the value of '2'
set global innodb_prefix_index_cluster_optimization = -3;
ERROR 42000: Variable 'innodb_prefix_index_cluster_optimization' can't be set to the value of '-3'
select @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
1
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
VARIABLE_NAME VARIABLE_VALUE
INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION ON
set global innodb_prefix_index_cluster_optimization = 'AUTO';
ERROR 42000: Variable 'innodb_prefix_index_cluster_optimization' can't be set to the value of 'AUTO'
#
# Cleanup
#
SET @@global.innodb_prefix_index_cluster_optimization = @start_global_value;
SELECT @@global.innodb_prefix_index_cluster_optimization;
@@global.innodb_prefix_index_cluster_optimization
0
...@@ -1256,10 +1256,10 @@ READ_ONLY YES ...@@ -1256,10 +1256,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION VARIABLE_NAME INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE OFF DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enable prefix optimization to sometimes avoid cluster index lookups. VARIABLE_COMMENT Deprecated parameter with no effect
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL
......
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_prefix_index_cluster_optimization;
SELECT @start_global_value;
--echo #
--echo # exists as global only
--echo #
--echo Valid values are 'ON' and 'OFF'
select @@global.innodb_prefix_index_cluster_optimization in (0, 1);
select @@global.innodb_prefix_index_cluster_optimization;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_prefix_index_cluster_optimization;
show global variables like 'innodb_prefix_index_cluster_optimization';
show session variables like 'innodb_prefix_index_cluster_optimization';
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
--echo #
--echo # show that it's writable
--echo #
set global innodb_prefix_index_cluster_optimization = 'OFF';
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
set @@global.innodb_prefix_index_cluster_optimization = 'ON';
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
set global innodb_prefix_index_cluster_optimization = 0;
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
set @@global.innodb_prefix_index_cluster_optimization = 1;
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
--error ER_GLOBAL_VARIABLE
set session innodb_prefix_index_cluster_optimization = 'OFF';
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_prefix_index_cluster_optimization = 'ON';
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
--echo #
--echo # incorrect types
--echo #
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_prefix_index_cluster_optimization = 1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_prefix_index_cluster_optimization = 1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_prefix_index_cluster_optimization = 2;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_prefix_index_cluster_optimization = -3;
select @@global.innodb_prefix_index_cluster_optimization;
select * from information_schema.global_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
select * from information_schema.session_variables where variable_name = 'innodb_prefix_index_cluster_optimization';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_prefix_index_cluster_optimization = 'AUTO';
--echo #
--echo # Cleanup
--echo #
SET @@global.innodb_prefix_index_cluster_optimization = @start_global_value;
SELECT @@global.innodb_prefix_index_cluster_optimization;
...@@ -1052,13 +1052,6 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -1052,13 +1052,6 @@ static SHOW_VAR innodb_status_variables[]= {
{"onlineddl_pct_progress", {"onlineddl_pct_progress",
&export_vars.innodb_onlineddl_pct_progress, SHOW_SIZE_T}, &export_vars.innodb_onlineddl_pct_progress, SHOW_SIZE_T},
/* Times secondary index lookup triggered cluster lookup and
times prefix optimization avoided triggering cluster lookup */
{"secondary_index_triggered_cluster_reads",
&export_vars.innodb_sec_rec_cluster_reads, SHOW_SIZE_T},
{"secondary_index_triggered_cluster_reads_avoided",
&export_vars.innodb_sec_rec_cluster_reads_avoided, SHOW_SIZE_T},
/* Encryption */ /* Encryption */
{"encryption_rotation_pages_read_from_cache", {"encryption_rotation_pages_read_from_cache",
&export_vars.innodb_encryption_rotation_pages_read_from_cache, SHOW_SIZE_T}, &export_vars.innodb_encryption_rotation_pages_read_from_cache, SHOW_SIZE_T},
...@@ -19349,11 +19342,13 @@ static MYSQL_SYSVAR_UINT(spin_wait_delay, srv_spin_wait_delay, ...@@ -19349,11 +19342,13 @@ static MYSQL_SYSVAR_UINT(spin_wait_delay, srv_spin_wait_delay,
"Maximum delay between polling for a spin lock (4 by default)", "Maximum delay between polling for a spin lock (4 by default)",
NULL, NULL, 4, 0, 6000, 0); NULL, NULL, 4, 0, 6000, 0);
static my_bool innodb_prefix_index_cluster_optimization;
static MYSQL_SYSVAR_BOOL(prefix_index_cluster_optimization, static MYSQL_SYSVAR_BOOL(prefix_index_cluster_optimization,
srv_prefix_index_cluster_optimization, innodb_prefix_index_cluster_optimization,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_DEPRECATED,
"Enable prefix optimization to sometimes avoid cluster index lookups.", "Deprecated parameter with no effect",
NULL, NULL, FALSE); nullptr, nullptr, TRUE);
static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path, static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
......
...@@ -175,8 +175,6 @@ enum monitor_id_t { ...@@ -175,8 +175,6 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGE_CREATED,
MONITOR_OVLD_PAGES_WRITTEN, MONITOR_OVLD_PAGES_WRITTEN,
MONITOR_OVLD_PAGES_READ, MONITOR_OVLD_PAGES_READ,
MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS,
MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED,
MONITOR_OVLD_BYTE_READ, MONITOR_OVLD_BYTE_READ,
MONITOR_OVLD_BYTE_WRITTEN, MONITOR_OVLD_BYTE_WRITTEN,
MONITOR_FLUSH_BATCH_SCANNED, MONITOR_FLUSH_BATCH_SCANNED,
......
...@@ -116,12 +116,6 @@ struct srv_stats_t ...@@ -116,12 +116,6 @@ struct srv_stats_t
/** Number of data read in total (in bytes) */ /** Number of data read in total (in bytes) */
ulint_ctr_1_t data_read; ulint_ctr_1_t data_read;
/** Number of times secondary index lookup triggered cluster lookup */
ulint_ctr_n_t n_sec_rec_cluster_reads;
/** Number of times prefix optimization avoided triggering cluster lookup */
ulint_ctr_n_t n_sec_rec_cluster_reads_avoided;
/** Number of encryption_get_latest_key_version calls */ /** Number of encryption_get_latest_key_version calls */
ulint_ctr_n_t n_key_requests; ulint_ctr_n_t n_key_requests;
...@@ -227,10 +221,6 @@ extern ulong srv_purge_rseg_truncate_frequency; ...@@ -227,10 +221,6 @@ extern ulong srv_purge_rseg_truncate_frequency;
/** Enable or Disable Truncate of UNDO tablespace. */ /** Enable or Disable Truncate of UNDO tablespace. */
extern my_bool srv_undo_log_truncate; extern my_bool srv_undo_log_truncate;
/* Optimize prefix index queries to skip cluster index lookup when possible */
/* Enables or disables this prefix optimization. Disabled by default. */
extern my_bool srv_prefix_index_cluster_optimization;
/** Default size of UNDO tablespace (10MiB for innodb_page_size=16k) */ /** Default size of UNDO tablespace (10MiB for innodb_page_size=16k) */
constexpr ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES= (10U << 20) / constexpr ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES= (10U << 20) /
UNIV_PAGE_SIZE_DEF; UNIV_PAGE_SIZE_DEF;
...@@ -727,9 +717,6 @@ struct export_var_t{ ...@@ -727,9 +717,6 @@ struct export_var_t{
/* Number of temporary tablespace pages decrypted */ /* Number of temporary tablespace pages decrypted */
ib_int64_t innodb_n_temp_blocks_decrypted; ib_int64_t innodb_n_temp_blocks_decrypted;
ulint innodb_sec_rec_cluster_reads; /*!< srv_sec_rec_cluster_reads */
ulint innodb_sec_rec_cluster_reads_avoided;/*!< srv_sec_rec_cluster_reads_avoided */
ulint innodb_encryption_rotation_pages_read_from_cache; ulint innodb_encryption_rotation_pages_read_from_cache;
ulint innodb_encryption_rotation_pages_read_from_disk; ulint innodb_encryption_rotation_pages_read_from_disk;
ulint innodb_encryption_rotation_pages_modified; ulint innodb_encryption_rotation_pages_modified;
......
...@@ -3337,9 +3337,6 @@ Row_sel_get_clust_rec_for_mysql::operator()( ...@@ -3337,9 +3337,6 @@ Row_sel_get_clust_rec_for_mysql::operator()(
*out_rec = NULL; *out_rec = NULL;
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
srv_stats.n_sec_rec_cluster_reads.inc(
thd_get_thread_id(trx->mysql_thd));
row_build_row_ref_in_tuple(prebuilt->clust_ref, rec, row_build_row_ref_in_tuple(prebuilt->clust_ref, rec,
sec_index, *offsets); sec_index, *offsets);
...@@ -4205,11 +4202,9 @@ bool row_search_with_covering_prefix( ...@@ -4205,11 +4202,9 @@ bool row_search_with_covering_prefix(
const dict_index_t* index = prebuilt->index; const dict_index_t* index = prebuilt->index;
ut_ad(!dict_index_is_clust(index)); ut_ad(!dict_index_is_clust(index));
if (dict_index_is_spatial(index)) { /* In ha_innobase::build_template() we choose to access the
return false; whole row when using exclusive row locks. */
} if (prebuilt->select_lock_type == LOCK_X || !index->is_btree()) {
if (!srv_prefix_index_cluster_optimization) {
return false; return false;
} }
...@@ -4276,7 +4271,6 @@ bool row_search_with_covering_prefix( ...@@ -4276,7 +4271,6 @@ bool row_search_with_covering_prefix(
ut_a(templ->rec_field_no != ULINT_UNDEFINED); ut_a(templ->rec_field_no != ULINT_UNDEFINED);
} }
srv_stats.n_sec_rec_cluster_reads_avoided.inc();
return true; return true;
} }
......
...@@ -278,18 +278,6 @@ static monitor_info_t innodb_counter_info[] = ...@@ -278,18 +278,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_READ}, MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_READ},
{"buffer_index_sec_rec_cluster_reads", "buffer",
"Number of secondary record reads triggered cluster read",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS},
{"buffer_index_sec_rec_cluster_reads_avoided", "buffer",
"Number of secondary record reads avoided triggering cluster read",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED},
{"buffer_data_reads", "buffer", {"buffer_data_reads", "buffer",
"Amount of data read in bytes (innodb_data_reads)", "Amount of data read in bytes (innodb_data_reads)",
static_cast<monitor_type_t>( static_cast<monitor_type_t>(
...@@ -1425,16 +1413,6 @@ srv_mon_process_existing_counter( ...@@ -1425,16 +1413,6 @@ srv_mon_process_existing_counter(
value = buf_pool.stat.n_pages_read; value = buf_pool.stat.n_pages_read;
break; break;
/* Number of times secondary index lookup triggered cluster lookup */
case MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS:
value = srv_stats.n_sec_rec_cluster_reads;
break;
/* Number of times prefix optimization avoided triggering cluster
lookup */
case MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED:
value = srv_stats.n_sec_rec_cluster_reads_avoided;
break;
/* innodb_data_reads, the total number of data reads */ /* innodb_data_reads, the total number of data reads */
case MONITOR_OVLD_BYTE_READ: case MONITOR_OVLD_BYTE_READ:
value = srv_stats.data_read; value = srv_stats.data_read;
......
...@@ -291,10 +291,6 @@ uint srv_fast_shutdown; ...@@ -291,10 +291,6 @@ uint srv_fast_shutdown;
/** copy of innodb_status_file; generate a innodb_status.<pid> file */ /** copy of innodb_status_file; generate a innodb_status.<pid> file */
ibool srv_innodb_status; ibool srv_innodb_status;
/** innodb_prefix_index_cluster_optimization; whether to optimize
prefix index queries to skip cluster index lookup when possible */
my_bool srv_prefix_index_cluster_optimization;
/** innodb_stats_transient_sample_pages; /** innodb_stats_transient_sample_pages;
When estimating number of different key values in an index, sample When estimating number of different key values in an index, sample
this many index pages, there are 2 ways to calculate statistics: this many index pages, there are 2 ways to calculate statistics:
...@@ -1031,11 +1027,6 @@ srv_export_innodb_status(void) ...@@ -1031,11 +1027,6 @@ srv_export_innodb_status(void)
export_vars.innodb_onlineddl_rowlog_pct_used = onlineddl_rowlog_pct_used; export_vars.innodb_onlineddl_rowlog_pct_used = onlineddl_rowlog_pct_used;
export_vars.innodb_onlineddl_pct_progress = onlineddl_pct_progress; export_vars.innodb_onlineddl_pct_progress = onlineddl_pct_progress;
export_vars.innodb_sec_rec_cluster_reads =
srv_stats.n_sec_rec_cluster_reads;
export_vars.innodb_sec_rec_cluster_reads_avoided =
srv_stats.n_sec_rec_cluster_reads_avoided;
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
export_vars.innodb_encryption_rotation_pages_read_from_cache = export_vars.innodb_encryption_rotation_pages_read_from_cache =
crypt_stat.pages_read_from_cache; crypt_stat.pages_read_from_cache;
......
...@@ -52,8 +52,6 @@ buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N ...@@ -52,8 +52,6 @@ buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N
buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created)
buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written)
buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read)
buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read
buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read
buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads) buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data read in bytes (innodb_data_reads)
buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written) buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Amount of data written in bytes (innodb_data_written)
buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_owner Total pages scanned as part of flush batch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment