1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-4240: mariadb 5.3.12 using more memory than MySQL 5.1 for an inefficient query

- Let index_merge allocate table handlers on quick select's MEM_ROOT,
  not on statement's MEM_ROOT. 
  This is crucial for big "range checked for each record" queries, where 
  index_merge can be created and deleted many times during query exection. 
  We should not make O(#rows) allocations on statement's MEM_ROOT.
This commit is contained in:
Sergey Petrunya
2013-04-01 18:03:14 +04:00
parent 3345e7564d
commit 763af1a8a3
2 changed files with 11 additions and 10 deletions

View File

@ -310,7 +310,7 @@ public:
0 Ok
other Error
*/
virtual int init_ror_merged_scan(bool reuse_handler)
virtual int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{ DBUG_ASSERT(0); return 1; }
/*
@ -448,7 +448,7 @@ public:
uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
int init_ror_merged_scan(bool reuse_handler);
int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
void save_last_pos()
{ file->position(record); }
int get_type() { return QS_TYPE_RANGE; }
@ -681,7 +681,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
int init_ror_merged_scan(bool reuse_handler);
int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range);
class QUICK_SELECT_WITH_RECORD : public Sql_alloc