mariadb/mysql-test/suite/sys_vars/t/new_mode.test
Sergei Petrunia 8916aeed28 MDEV-37723: TPROC-H Query4 much slower in 11.4 than in 10.11
(Patch provided by Monty, Testcase by Rex Johnston)

get_tmp_table_costs() computes the cost of using a temporary (work
table) for certain cases, including semi-join subquery materialization.

The computed cost value was very low, it used this formula:
  key_lookup_cost * (disk_read_ratio= 0.02)

Use the correct formula:

   key_lookup_cost // Index lookup is always done
   +
   disk_read_cost * disk_read_ratio

disk_read_cost is incurred when the lookup has to go to disk.
We assume this doesn't occur for every lookup. It happens only with
disk_read_ratio=0.02 frequency.

The fix is controlled by @@new_mode='FIX_DISK_TMPTABLE_COSTS' flag.
It is OFF by default in this patch.
2025-10-05 10:44:34 +03:00

53 lines
1.3 KiB
Text

--source include/load_sysvars.inc
--source include/have_debug.inc
SET @global_start_value = @@global.new_mode;
SELECT @global_start_value;
SET @session_start_value = @@session.new_mode;
SELECT @session_start_value;
SET @@global.new_mode = "FIX_DISK_TMPTABLE_COSTS";
SELECT @@global.new_mode;
SELECT @@session.new_mode;
SET @@global.new_mode = DEFAULT;
SELECT @@global.new_mode;
SELECT @@session.new_mode;
SET @@session.new_mode = "FIX_DISK_TMPTABLE_COSTS,TEST_WARNING1";
SET @@session.new_mode = "FIX_DISK_TMPTABLE_COSTS,TEST_WARNING1,TEST_WARNING2";
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.new_mode = "FIX_DISK_TMPTABLE_COSTS,TEST_WARNING1,TEST_WARNING2,TEST_WARNING3";
SET @@session.new_mode = "ALL";
select @@session.new_mode;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.new_mode = NULL;
SET @@global.new_mode = '';
SELECT @@global.new_mode;
SET @@global.new_mode = ' ';
SELECT @@global.new_mode;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.new_mode = NULL;
SET @@session.new_mode = '';
SELECT @@session.new_mode;
SET @@session.new_mode = ' ';
SELECT @@session.new_mode;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.new_mode = OFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.new_mode = OFF;
SET @@global.new_mode = @global_start_value;
SELECT @@global.new_mode;
SET @@session.new_mode = @session_start_value;
SELECT @@session.new_mode;