revision-id: 4bff8b0b03ba82cd0ae6817b54de1780e89047ca
parent(s): 3526fe1b6000b2558290007e5cc3a1018850787c
committer: Sergey Vojtovich
branch nick: 10.1
timestamp: 2014-12-04 17:44:46 +0400
message:
MDEV-7004 - Merge scalability fixes from 10.0-power
Preallocate dynamic array and bitmap on mem_root to avoid expensive malloc.
This reduces number of allocations from 39 to 31 per OLTP RO transaction.
---
sql/opt_range.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 1a9ae3d..813508c 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1838,8 +1838,6 @@ void SQL_SELECT::cleanup()
index= key_nr;
head= table;
key_part_info= head->key_info[index].key_part;
- my_init_dynamic_array(&ranges, sizeof(QUICK_RANGE*), 16, 16,
- MYF(MY_THREAD_SPECIFIC));
/* 'thd' is not accessible in QUICK_RANGE_SELECT::reset(). */
mrr_buf_size= thd->variables.mrr_buff_size;
@@ -1857,9 +1855,12 @@ void SQL_SELECT::cleanup()
file= head->file;
record= head->record[0];
- /* Allocate a bitmap for used columns (Q: why not on MEM_ROOT?) */
- if (!(bitmap= (my_bitmap_map*) my_malloc(head->s->column_bitmap_size,
- MYF(MY_WME | MY_THREAD_SPECIFIC))))
+ my_init_dynamic_array2(&ranges, sizeof(QUICK_RANGE*),
+ thd->alloc(sizeof(QUICK_RANGE*) * 16), 16, 16,
+ MYF(MY_THREAD_SPECIFIC));
+
+ /* Allocate a bitmap for used columns */
+ if (!(bitmap= (my_bitmap_map*) thd->alloc(head->s->column_bitmap_size)))
{
column_bitmap.bitmap= 0;
*create_error= 1;
@@ -1923,7 +1924,6 @@ void QUICK_RANGE_SELECT::range_end()
}
delete_dynamic(&ranges); /* ranges are allocated in alloc */
free_root(&alloc,MYF(0));
- my_free(column_bitmap.bitmap);
}
my_free(mrr_buf_desc);
DBUG_VOID_RETURN;
_______________________________________________
commits mailing list
commits@xxxxxxxxxxx
https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits