[MDEV-18746] Reduce the amount of mem_heap_create() or malloc() Created: 2019-02-26 Updated: 2024-01-19 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | memory, performance | ||
| Issue Links: |
|
||||||||||||
| Description |
|
InnoDB is frequently allocating and deallocating memory during simple operations, such as INSERT or UPDATE. It should be more efficient to use a single mem_heap_t for the whole row operation, maybe row_prebuilt_t::heap. Maybe some dynamic allocations could be avoided altogether. Perhaps we could use one or two preallocated buffers for rec_get_offsets(), possibly in btr_cur_t or page_cur_t, and avoid repeated calls to rec_get_offsets(). |
| Comments |
| Comment by Eugene Kosov (Inactive) [ 2019-02-27 ] |
|
Maximum possible offset fits into uint16_t, right? And maximum amount of offsets is less than 1024 (REC_MAX_N_FIELDS). So, what about making offsets array a stack variable? No mem_heap_t will be needed for records then. |
| Comment by Marko Mäkelä [ 2019-11-02 ] |
|
I think that MDEV-16232 would involve moving mtr_t and offsets to row_prebuilt_t, and thus we would end up having fewer dynamic allocation operations. |