mariadb/storage/heap
Monty 52c29f3bdc MDEV-35469 Heap tables are calling mallocs to often
Heap tables are allocated blocks to store rows according to
my_default_record_cache (mapped to the server global variable
 read_buffer_size).
This causes performance issues when the record length is big
(> 1000 bytes) and the my_default_record_cache is small.

Changed to instead split the default heap allocation to 1/16 of the
allowed space and not use my_default_record_cache anymore when creating
the heap. The allocation is also aligned to be just under a power of 2.

For some test that I have been running, which was using record length=633,
the speed of the query doubled thanks to this change.

Other things:
- Fixed calculation of max_records passed to hp_create() to take
  into account padding between records.
- Updated calculation of memory needed by heap tables. Before we
  did not take into account internal structures needed to access rows.
- Changed block sized for memory_table from 1 to 16384 to get less
  fragmentation. This also avoids a problem where we need 1K
  to manage index and row storage which was not counted for before.
- Moved heap memory usage to a separate test for 32 bit.
- Allocate all data blocks in heap in powers of 2. Change reported
  memory usage for heap to reflect this.

Reviewed-by: Sergei Golubchik <serg@mariadb.org>
2025-01-05 16:40:11 +02:00
..
mysql-test/mtr2
_check.c Merge 5.5 into 10.1 2019-11-06 08:17:03 +02:00
_rectest.c
ChangeLog Fix various spelling errors still found in code 2021-03-22 18:10:39 +11:00
CMakeLists.txt Add -berok for head test on AIX 2020-12-16 08:07:04 +11:00
ha_heap.cc MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00
ha_heap.h MDEV-33746 Supply missing override markings 2024-06-20 11:32:13 -04:00
heapdef.h MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00
hp_block.c MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00
hp_clear.c
hp_close.c
hp_create.c MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00
hp_delete.c
hp_extra.c
hp_hash.c Added page_range to records_in_range() to improve range statistics 2020-03-27 03:54:45 +02:00
hp_info.c MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO 2024-05-22 09:18:09 +10:00
hp_open.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_panic.c
hp_rename.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_rfirst.c
hp_rkey.c
hp_rlast.c
hp_rnext.c
hp_rprev.c
hp_rrnd.c
hp_rsame.c
hp_scan.c
hp_static.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_test1.c Fix clang -Wunused-but-set-variable in unit tests 2022-07-26 08:18:36 +03:00
hp_test2.c
hp_update.c
hp_write.c MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00