mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-7951 - sql_alloc() takes 0.25% in OLTP RO
sql_alloc() has additional costs compared to direct mem_root allocation: - function call: it is defined in a separate translation unit and can't be inlined - it needs to call pthread_getspecific() to get THD::mem_root It is called dozens of times implicitely at least by: - List<>::push_back() - List<>::push_front() - new (for Sql_alloc derived classes) - sql_memdup() Replaced lots of implicit sql_alloc() calls with direct mem_root allocation, passing through THD pointer whenever it is needed. Number of sql_alloc() calls reduced 345 -> 41 per OLTP RO transaction. pthread_getspecific() overhead dropped 0.76 -> 0.59 sql_alloc() overhed dropped 0.25 -> 0.06
This commit is contained in:
@ -9354,7 +9354,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
if (thd->lex->select_lex.setup_ref_array(thd, order_num) ||
|
||||
setup_order(thd, thd->lex->select_lex.ref_pointer_array,
|
||||
&tables, fields, all_fields, order) ||
|
||||
!(sortorder= make_unireg_sortorder(order, &length, NULL)) ||
|
||||
!(sortorder= make_unireg_sortorder(thd, order, &length, NULL)) ||
|
||||
(from->sort.found_records= filesort(thd, from, sortorder, length,
|
||||
NULL, HA_POS_ERROR,
|
||||
true,
|
||||
|
Reference in New Issue
Block a user