[MDEV-18257] Make memory usage safer for temp tables Created: 2019-01-15 Updated: 2023-11-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Manjot Singh (Inactive) | Assignee: | Ralf Gebhardt |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Through conversations with a customer, adding variables to make temp tables in memory and memory table size more measurable. These variables should be a maximum of a global (or session) total. ie memory for tmp or heap tables in total can never exceed this value. 2 variables should be added: If set, queries wanting to insert to or create in memory tables would wait on memory availability or they could just go to disk as on disk temp tables. This could be controlled with another variable, such as max_total_heap_table_wait=0|1 For example, if max_total_tmp_table_size = 1G, and 9 connections do 1 query each which creates 9 100M tables. Query 10 comes through and creates 101M of temp table, it cannot complete until one of the previous 9 queries deallocates memory, ie deletes rows or drops tables. While this makes more sense as a global variable, it could also be per session, in that this session cannot exceed the session or global total at all (whichever is lower). Defaults should be 0 (unlimited). |
| Comments |
| Comment by Oleksandr Byelkin [ 2019-05-16 ] |
|
Have author of this read about max_heap_table_size? Actually what the difference between temporary and heap total? I suppose one is for query execution other for ususal tables. Automatic internal query: Usual in memory tables: |
| Comment by Manjot Singh (Inactive) [ 2019-05-16 ] |
|
@Oleksandr @ralf what I see commonly with enterprise customers is overuse of temp tables at concurrency. 1) What this ticket is, is a GLOBAL limit on all, not individual queries, not connections, the entire mariadb server. 2) this is about in memory temp tables just like tmp_table_size. max_tmp_tables is an unused variable so this is not helpful and would probably apply to in memory and on disk tables. What we need is a way to limit overall server memory use and have queries queue just like other enterprise RDBMS products. |