1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Optimize size of lex structures

LEX, st_select_lex, st_select_unit optimized for space:
- Use bit fields for bool variables
- Ensure that all bit fields are initialized (improves
  performance for init functions as all bit fields can be
  initalized with one memory access)
- Move members around in above structures to remove alignment
  gaps

Some savings:
LEX: 7032 -> 6880
THD: 25608 -> 25456
st_select_lex_unit: 2048 -> 2008

LEX::start():                    1321 -> 1245 instructions
st_select_lex_unit::init_query()  284 ->  214 instructions
st_select_lex::init_query():      766 ->  692 instructions
st_select_lex::init_select():     563 ->  540 instructions

Other things:
- Removed not used LEX::select_allow_into
- Fixed MDEV-25510 Assertion `sel->select_lock ==
   st_select_lex::select_lock_type::NONE' which was caused by this commit.
This commit is contained in:
Monty
2020-08-28 17:11:55 +03:00
committed by Sergei Golubchik
parent fa7d4abf16
commit 8e8bda7fd3
4 changed files with 393 additions and 312 deletions

View File

@ -2105,3 +2105,28 @@ ERROR HY000: Unknown data type: 'ACTION'
#
# End of 10.5 tests
#
#
# Start of 10.6 tests
#
#
# MDEV-25510 Assertion `sel->select_lock ==
# st_select_lex::select_lock_type::NONE' failed in Lex_select_lock::set_to
#
(SELECT x FROM t WINDOW w1 AS () FOR UPDATE) LIMIT 1;
ERROR 42S02: Table 'test.t' doesn't exist
create table t1 (x int);
insert into t1 values (1),(2);
explain extended (SELECT x FROM t1 WINDOW w1 as () FOR UPDATE) LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 (select `test`.`t1`.`x` AS `x` from `test`.`t1` limit 1)
explain extended (SELECT x FROM t1 FOR UPDATE) LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 (select `test`.`t1`.`x` AS `x` from `test`.`t1` limit 1)
drop table t1;
#
# End of 10.6 tests
#