forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS-5783: New thread variables: innodb_(force_index_)records_in_range
These variables make it possible to override reconds_in_range, effectively skipping its computation. This could be useful in some cases where reconds_in_range takes up most of the query cost.
- Loading branch information
Showing
7 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
mysql-test/suite/sys_vars/r/innodb_force_index_records_in_range_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
@@GLOBAL.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SET @@GLOBAL.innodb_force_index_records_in_range=100; | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
@@GLOBAL.innodb_force_index_records_in_range | ||
100 | ||
100 Expected | ||
SET @@GLOBAL.innodb_force_index_records_in_range=DEFAULT; | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
@@GLOBAL.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
@@GLOBAL.innodb_force_index_records_in_range = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
@@GLOBAL.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
VARIABLE_VALUE | ||
0 | ||
0 Expected | ||
SELECT @@innodb_force_index_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
@@innodb_force_index_records_in_range = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
VARIABLE_VALUE | ||
0 | ||
0 Expected | ||
SELECT @@innodb_force_index_records_in_range = @@GLOBAL.innodb_force_index_records_in_range; | ||
@@innodb_force_index_records_in_range = @@GLOBAL.innodb_force_index_records_in_range | ||
1 | ||
1 Expected | ||
SELECT @@innodb_force_index_records_in_range; | ||
@@innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@local.innodb_force_index_records_in_range; | ||
@@local.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@SESSION.innodb_force_index_records_in_range; | ||
@@SESSION.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
@@GLOBAL.innodb_force_index_records_in_range | ||
0 | ||
0 Expected | ||
SELECT innodb_force_index_records_in_range; | ||
ERROR 42S22: Unknown column 'innodb_force_index_records_in_range' in 'field list' | ||
Expected error 'Unknow column in field list' |
67 changes: 67 additions & 0 deletions
67
mysql-test/suite/sys_vars/r/innodb_records_in_range_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
@@GLOBAL.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SET @@GLOBAL.innodb_records_in_range=100; | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
@@GLOBAL.innodb_records_in_range | ||
100 | ||
100 Expected | ||
SET @@GLOBAL.innodb_records_in_range=DEFAULT; | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
@@GLOBAL.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@GLOBAL.innodb_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
@@GLOBAL.innodb_records_in_range = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
@@GLOBAL.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
VARIABLE_VALUE | ||
0 | ||
0 Expected | ||
SELECT @@innodb_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
@@innodb_records_in_range = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
VARIABLE_VALUE | ||
0 | ||
0 Expected | ||
SELECT @@innodb_records_in_range = @@GLOBAL.innodb_records_in_range; | ||
@@innodb_records_in_range = @@GLOBAL.innodb_records_in_range | ||
1 | ||
1 Expected | ||
SELECT @@innodb_records_in_range; | ||
@@innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@local.innodb_records_in_range; | ||
@@local.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@SESSION.innodb_records_in_range; | ||
@@SESSION.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
@@GLOBAL.innodb_records_in_range | ||
0 | ||
0 Expected | ||
SELECT innodb_records_in_range; | ||
ERROR 42S22: Unknown column 'innodb_records_in_range' in 'field list' | ||
Expected error 'Unknow column in field list' |
63 changes: 63 additions & 0 deletions
63
mysql-test/suite/sys_vars/t/innodb_force_index_records_in_range_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--source include/have_innodb.inc | ||
|
||
# Display default value | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
# Check if value can be set | ||
SET @@GLOBAL.innodb_force_index_records_in_range=100; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 100 Expected | ||
|
||
SET @@GLOBAL.innodb_force_index_records_in_range=DEFAULT; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
# Check if the value in GLOBAL TABLE matches value in variable | ||
SELECT @@GLOBAL.innodb_force_index_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
--echo 0 Expected | ||
|
||
SELECT @@innodb_force_index_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
--echo 1 Expected | ||
|
||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_force_index_records_in_range'; | ||
--echo 0 Expected | ||
|
||
# Check if accessing variable with and without GLOBAL point to same variable | ||
SELECT @@innodb_force_index_records_in_range = @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 1 Expected | ||
|
||
# Check if innodb_force_index_records_in_range can be accessed with and without @@ sign | ||
SELECT @@innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@local.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@SESSION.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@GLOBAL.innodb_force_index_records_in_range; | ||
--echo 0 Expected | ||
|
||
--Error ER_BAD_FIELD_ERROR | ||
SELECT innodb_force_index_records_in_range; | ||
--echo Expected error 'Unknow column in field list' |
63 changes: 63 additions & 0 deletions
63
mysql-test/suite/sys_vars/t/innodb_records_in_range_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--source include/have_innodb.inc | ||
|
||
# Display default value | ||
SELECT @@GLOBAL.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
# Check if value can be set | ||
SET @@GLOBAL.innodb_records_in_range=100; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_records_in_range; | ||
--echo 100 Expected | ||
|
||
SET @@GLOBAL.innodb_records_in_range=DEFAULT; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
# Check if the value in GLOBAL TABLE matches value in variable | ||
SELECT @@GLOBAL.innodb_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.global_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
--echo 0 Expected | ||
|
||
SELECT @@innodb_records_in_range = VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
--echo 1 Expected | ||
|
||
SELECT VARIABLE_VALUE | ||
FROM performance_schema.session_variables | ||
WHERE VARIABLE_NAME='innodb_records_in_range'; | ||
--echo 0 Expected | ||
|
||
# Check if accessing variable with and without GLOBAL point to same variable | ||
SELECT @@innodb_records_in_range = @@GLOBAL.innodb_records_in_range; | ||
--echo 1 Expected | ||
|
||
# Check if innodb_records_in_range can be accessed with and without @@ sign | ||
SELECT @@innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@local.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@SESSION.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
SELECT @@GLOBAL.innodb_records_in_range; | ||
--echo 0 Expected | ||
|
||
--Error ER_BAD_FIELD_ERROR | ||
SELECT innodb_records_in_range; | ||
--echo Expected error 'Unknow column in field list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters