summaryrefslogtreecommitdiff
path: root/sql/item_sum.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-21 16:07:54 +0200
committerSergei Golubchik <serg@mariadb.org>2019-04-24 16:06:54 +0200
commit979cad229148ba8d28d94c1ca621bacd11847b66 (patch)
tree127609c70f86a96f7b8b5ee8e1348b9c33673f2c /sql/item_sum.h
parente91fd8783a5343dcd32917e35fa03b2dbe00021d (diff)
downloadmariadb-git-979cad229148ba8d28d94c1ca621bacd11847b66.tar.gz
MDEV-9531 GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's executed
group concat tree is allocated in a memroot, so the only way to free memory is to copy a part of the tree into a new memroot. track the accumilated length of the result, and when it crosses the threshold - copy the result into a new tree, free the old one.
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r--sql/item_sum.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h
index dc672486bce..001d1d13fe4 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1431,6 +1431,7 @@ class Item_func_group_concat : public Item_sum
String *separator;
TREE tree_base;
TREE *tree;
+ size_t tree_len;
Item **ref_pointer_array;
/**
@@ -1468,6 +1469,8 @@ class Item_func_group_concat : public Item_sum
element_count count __attribute__((unused)),
void* item_arg);
+ bool repack_tree(THD *thd);
+
public:
Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
bool is_distinct, List<Item> *is_select,