[MDEV-14275] Improving memory utilization for information schema Created: 2017-11-03 Updated: 2020-10-23 Resolved: 2018-04-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Information Schema |
| Fix Version/s: | 10.3.6 |
| Type: | Task | Priority: | Major |
| Reporter: | Michael Widenius | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | contribution, foundation | ||
| Attachments: |
|
| Description |
|
This task is about improving memory utilization and performance for Some work has recently been done in bb-10.2-ext to free memory early for
Here we used 600K memory for a simple query
Here we used 5M memory for a simple query over 341 tables. The reason for the excessive memory used comes from that the temporary table While running:
in gdb:
Two possible ways to fix this: 1) Extend heap tables to store VARCHAR and BLOB efficiently 1) is a major tasks and we can't get that done in time for 10.3 This task is to do 2) This should not be that hard as information_schema already knows which This should be done against the bb-10.2-ext tree, which has the new |
| Comments |
| Comment by musazhang [ 2017-12-15 ] |
|
Hi, TXSQL from Tencent has work on this issue and improved memory used during query on information_schema. The ideas just like bellow: 1) Fields used by select and where cond should be collected during query. The attachment is based on bb-10.2-ext tree, would you please have a look on it and give some suggestions ? |
| Comment by musazhang [ 2017-12-15 ] |
|
By the way, we didn't deal with "order by" or "group by" and in this case, there may be wrong results when query use "order by", "group by". So, give me some suggestions and I will modify it according your suggestions. |
| Comment by musazhang [ 2017-12-25 ] |
|
I built a branch named bb-10.2-ext (https://github.com/musazhang/bb-10.2-ext), and commit the change based on it , you can find the change by visiting https://github.com/musazhang/bb-10.2-ext/commit/f1273a78900466e641995ecc01a86a6bda9176e3, thank you. |
| Comment by Michael Widenius [ 2018-03-12 ] |
|
Working on review |
| Comment by Michael Widenius [ 2018-03-26 ] |
|
diff --git a/sql/sql_show.cc b/sql/sql_show.cc +bool evaluate_schema_field_recursive(Item* item, const char* field_name) + + return false; + return false; The above function doesn't check all possible item types, for example + + The above was quite ok, but it missed a couple of things:
/** TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
+ show_field= field_can_be_used_in_query(thd, fields_info);
The above code was ok. What was missing in the code:
To solve the issue with the not handled queries, I decide to use a little
The final patch is attached to this issue. Note that even if I decided to use a different approach, having your code |