[MCOL-1950] Join & aggregation memory saving Created: 2018-11-19 Updated: 2020-01-07 Resolved: 2020-01-07 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.3 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Patrick LeBlanc (Inactive) | Assignee: | Patrick LeBlanc (Inactive) |
| Resolution: | Won't Do | Votes: | 2 |
| Labels: | None | ||
| Epic Link: | ColumnStore Performance Improvements |
| Description |
|
Our hash tables are currently unordered_multimaps, where the key is redundant with one (or more) of the columns stored as the value. We could use reduce mem usage by using an unordered_multiset, not storing the keys seperately, and using functors that know what the key columns are to generate the hash() and equal_to() values to make it function like the multimaps we're using now. |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2018-11-20 ] |
|
This would likely give us a good performance boost in these operations too I believe. |
| Comment by Patrick LeBlanc (Inactive) [ 2019-12-03 ] |
|
Have to put on hold for a day or two. hopefully can still finish this by Friday. |
| Comment by Patrick LeBlanc (Inactive) [ 2020-01-03 ] |
|
Finally finished this one. Changed the way memory was saved. I implemented the original idea and once it was working, I saw that mem usage hadn't dropped as much as i thought it should have. Investigated, found that the bulk of the memory used in my tests was used by the hash table itself rather than the nodes of the table. I added a hint to allow our allocators to distinguish between the two types of allocations. Nodes are allocated by the pool, tables allocated by the system allocator, so that they could be deallocated when they need to grow. This alone cut memory usage by ~70%. (4GB down to 1.2GB). This also has the benefit of being automatically applicable to every hash table using our STLPoolAllocator (all join types, agg/group-by, distinct, union) on the UM and PM. The original idea above saved little memory by comparison, 200MB, was relatively complex, and was only implemented for numeric UM joins, so I will keep that aside in a separate branch in case we really need to save a little more mem. |
| Comment by Patrick LeBlanc (Inactive) [ 2020-01-06 ] |
|
My mistake, faulty KPIs. Now seeing the expected 25% mem reduction. Also GTK, the std hash & set structs use 8 bytes more per node than the tr1 versions. |
| Comment by Patrick LeBlanc (Inactive) [ 2020-01-07 ] |
|
The extra work required by the new functors results in a performance drop is 15-20% end-to-end according to my benchmarks, so concluded that this isn't worth doing. I will keep the work in the um-join-mem-reduction branch in my fork of the engine repo. |