diff --git a/mysql-test/main/fast_prefix_index_fetch_innodb.result b/mysql-test/main/fast_prefix_index_fetch_innodb.result index aa888fb0704..1ce29100c66 100644 --- a/mysql-test/main/fast_prefix_index_fetch_innodb.result +++ b/mysql-test/main/fast_prefix_index_fetch_innodb.result @@ -1,8 +1,3 @@ -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 GLOBAL innodb_stats_persistent = OFF; # Create a table with a large varchar field that we index the prefix @@ -31,110 +26,39 @@ id fake_id bigfield 32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 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. select id, bigfield from prefixinno where bigfield = repeat('d', 31); id bigfield 31 ddddddddddddddddddddddddddddddd -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Eligible for optimization, access via fake_id only. select id, bigfield from prefixinno where fake_id = 1031; id bigfield 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. select id, bigfield from prefixinno where fake_id = 1033; id bigfield 33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -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('x', 32); id bigfield 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); id bigfield 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); id bigfield 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); id bigfield 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); id bigfield 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; id bigfield 33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 drop table prefixinno; # Multi-byte handling case -set global innodb_prefix_index_cluster_optimization = ON; SET NAMES utf8mb4; CREATE TABLE t1( f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN, @@ -146,113 +70,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; f1 a -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; f1 cccc cčc -select @cluster_lookups; -@cluster_lookups -3 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; f1 až -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; f1 தமிழ் -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; f1 ggᵷg -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; f1 😊me -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; f1 ls¢ -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%'; f1 ¢¢ -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; f1 🐱🌑 -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; f1 🌑 -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -2 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; f1 🌒 -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -2 DROP TABLE t1; # Multi-byte with minimum character length > 1 bytes CREATE TABLE t1( @@ -265,113 +123,47 @@ INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a'; f1 a -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%'; f1 cccc cčc -select @cluster_lookups; -@cluster_lookups -3 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až'; f1 až -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்'; f1 தமிழ் -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%'; f1 ggᵷg -select @cluster_lookups; -@cluster_lookups -2 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%'; f1 😊me -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Not eligible - record length longer than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢'; f1 ls¢ -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%'; f1 ¢¢ -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Eligible - record length shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%'; f1 🐱🌑 -select @cluster_lookups; -@cluster_lookups -1 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Eligible - record length is shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%'; f1 🌑 -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -2 # Eligible - record length is shorter than prefix length SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%'; f1 🌒 -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -2 DROP TABLE t1; CREATE TABLE t1( col1 INT, @@ -383,22 +175,10 @@ INSERT INTO t1(col1) VALUES(1); SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL; col1 1 -select @cluster_lookups; -@cluster_lookups -0 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -1 # Not eligible - record length longer than prefix index SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%'; col1 3 -select @cluster_lookups; -@cluster_lookups -2 -select @cluster_lookups_avoided; -@cluster_lookups_avoided -0 DROP TABLE t1; # # MDEV-20464 Division by 0 in row_search_with_covering_prefix() @@ -443,18 +223,10 @@ INSERT INTO wp_blogs (domain, path) VALUES ('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'), ('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'), ('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') AND path IN ( '/fondsinvesteringer/', '/' ); blog_id 2 1 DROP TABLE wp_blogs; -SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt; SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent; diff --git a/mysql-test/main/fast_prefix_index_fetch_innodb.test b/mysql-test/main/fast_prefix_index_fetch_innodb.test index cb7ec642fe3..7afe08bd607 100644 --- a/mysql-test/main/fast_prefix_index_fetch_innodb.test +++ b/mysql-test/main/fast_prefix_index_fetch_innodb.test @@ -1,9 +1,5 @@ -- 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 GLOBAL innodb_stats_persistent = OFF; @@ -28,185 +24,28 @@ insert into prefixinno values (1, 1001, repeat('a', 1)), 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. -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); -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. -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; -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. -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; -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('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); -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); - -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); - -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); - -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; -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; --echo # Multi-byte handling case -set global innodb_prefix_index_cluster_optimization = ON; SET NAMES utf8mb4; CREATE TABLE t1( f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN, @@ -217,200 +56,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑'); INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); --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'; -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 -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%'; -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 -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ž'; -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 - -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 = 'தமிழ்'; -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 - -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ᵷ%'; -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 - -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 '😊%'; -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 - -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¢'; -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 - -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 '¢¢%'; -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 - -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 '🐱🌑%'; -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 - -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 '🌑%'; -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 - -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 '🌒%'; -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; --echo # Multi-byte with minimum character length > 1 bytes @@ -424,201 +101,38 @@ INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑'); INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢'); --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'; -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 -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%'; -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 - -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ž'; -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 - -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 = 'தமிழ்'; -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 - -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ᵷ%'; -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 - -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 '😊%'; -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 - -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¢'; -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 - -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 '¢¢%'; -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 - -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 '🐱🌑%'; -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 - -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 '🌑%'; -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 - -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 '🌒%'; -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; CREATE TABLE t1( @@ -629,41 +143,11 @@ INSERT INTO t1 VALUES (2, 'test'), (3, repeat('test1', 2000)); INSERT INTO t1(col1) VALUES(1); --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; -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 - -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%'; -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; --echo # @@ -709,15 +193,9 @@ INSERT INTO wp_blogs (domain, path) VALUES ('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'), ('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') AND path IN ( '/fondsinvesteringer/', '/' ); DROP TABLE wp_blogs; -SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt; SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent; diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index 2b1228f34f8..bc5051b1442 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -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_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_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_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 diff --git a/mysql-test/suite/innodb/r/innodb_status_variables.result b/mysql-test/suite/innodb/r/innodb_status_variables.result index 369ca9575d9..2271cf48b14 100644 --- a/mysql-test/suite/innodb/r/innodb_status_variables.result +++ b/mysql-test/suite/innodb/r/innodb_status_variables.result @@ -98,8 +98,6 @@ INNODB_INSTANT_ALTER_COLUMN INNODB_ONLINEDDL_ROWLOG_ROWS INNODB_ONLINEDDL_ROWLOG_PCT_USED 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_DISK INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index fbfa18130ef..24cd0ed064e 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -36,8 +36,6 @@ buffer_pool_pages_free disabled buffer_pages_created disabled buffer_pages_written 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_written disabled buffer_flush_batch_scanned disabled diff --git a/mysql-test/suite/sys_vars/r/innodb_prefix_index_cluster_optimization_basic.result b/mysql-test/suite/sys_vars/r/innodb_prefix_index_cluster_optimization_basic.result deleted file mode 100644 index 57b653bcf5e..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_prefix_index_cluster_optimization_basic.result +++ /dev/null @@ -1,122 +0,0 @@ -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 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 2f193f5c96b..89ae50863cf 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1256,10 +1256,10 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PREFIX_INDEX_CLUSTER_OPTIMIZATION SESSION_VALUE NULL -DEFAULT_VALUE OFF +DEFAULT_VALUE ON VARIABLE_SCOPE GLOBAL 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_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/t/innodb_prefix_index_cluster_optimization_basic.test b/mysql-test/suite/sys_vars/t/innodb_prefix_index_cluster_optimization_basic.test deleted file mode 100644 index 4e272fbd9c5..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_prefix_index_cluster_optimization_basic.test +++ /dev/null @@ -1,76 +0,0 @@ ---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; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 20da89b8709..d0143497386 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1052,13 +1052,6 @@ static SHOW_VAR innodb_status_variables[]= { {"onlineddl_pct_progress", &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_rotation_pages_read_from_cache", &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, "Maximum delay between polling for a spin lock (4 by default)", NULL, NULL, 4, 0, 6000, 0); +static my_bool innodb_prefix_index_cluster_optimization; + static MYSQL_SYSVAR_BOOL(prefix_index_cluster_optimization, - srv_prefix_index_cluster_optimization, - PLUGIN_VAR_OPCMDARG, - "Enable prefix optimization to sometimes avoid cluster index lookups.", - NULL, NULL, FALSE); + innodb_prefix_index_cluster_optimization, + PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_DEPRECATED, + "Deprecated parameter with no effect", + nullptr, nullptr, TRUE); static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index b19a5be1d29..51f3049b81a 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -175,8 +175,6 @@ enum monitor_id_t { MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGES_WRITTEN, 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_WRITTEN, MONITOR_FLUSH_BATCH_SCANNED, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index b6cf3a653c5..cc78696ee77 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -116,12 +116,6 @@ struct srv_stats_t /** Number of data read in total (in bytes) */ 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 */ ulint_ctr_n_t n_key_requests; @@ -227,10 +221,6 @@ extern ulong srv_purge_rseg_truncate_frequency; /** Enable or Disable Truncate of UNDO tablespace. */ 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) */ constexpr ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES= (10U << 20) / UNIV_PAGE_SIZE_DEF; @@ -727,9 +717,6 @@ struct export_var_t{ /* Number of temporary tablespace pages 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_disk; ulint innodb_encryption_rotation_pages_modified; diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 48647fcb622..33bbc37c6ee 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -3337,9 +3337,6 @@ Row_sel_get_clust_rec_for_mysql::operator()( *out_rec = NULL; 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, sec_index, *offsets); @@ -4205,11 +4202,9 @@ bool row_search_with_covering_prefix( const dict_index_t* index = prebuilt->index; ut_ad(!dict_index_is_clust(index)); - if (dict_index_is_spatial(index)) { - return false; - } - - if (!srv_prefix_index_cluster_optimization) { + /* In ha_innobase::build_template() we choose to access the + whole row when using exclusive row locks. */ + if (prebuilt->select_lock_type == LOCK_X || !index->is_btree()) { return false; } @@ -4276,7 +4271,6 @@ bool row_search_with_covering_prefix( ut_a(templ->rec_field_no != ULINT_UNDEFINED); } - srv_stats.n_sec_rec_cluster_reads_avoided.inc(); return true; } diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 9478a77c0ff..32dee38c74b 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -278,18 +278,6 @@ static monitor_info_t innodb_counter_info[] = MONITOR_EXISTING | MONITOR_DEFAULT_ON), 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_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_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED}, - {"buffer_data_reads", "buffer", "Amount of data read in bytes (innodb_data_reads)", static_cast( @@ -1425,16 +1413,6 @@ srv_mon_process_existing_counter( value = buf_pool.stat.n_pages_read; 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 */ case MONITOR_OVLD_BYTE_READ: value = srv_stats.data_read; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 3ffa58274ec..f115387893a 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -291,10 +291,6 @@ uint srv_fast_shutdown; /** copy of innodb_status_file; generate a innodb_status. file */ 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; When estimating number of different key values in an index, sample this many index pages, there are 2 ways to calculate statistics: @@ -1031,11 +1027,6 @@ srv_export_innodb_status(void) export_vars.innodb_onlineddl_rowlog_pct_used = onlineddl_rowlog_pct_used; 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) { export_vars.innodb_encryption_rotation_pages_read_from_cache = crypt_stat.pages_read_from_cache; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result index 0ced7845a53..de5ed76ad27 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result @@ -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_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_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_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