mirror of
https://github.com/MariaDB/server.git
synced 2025-02-11 16:05:34 +01:00
![Monty](/assets/img/avatar_default.png)
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>
40 lines
1.6 KiB
Text
40 lines
1.6 KiB
Text
--- suite/heap/heap_memory_used.result
|
|
+++ suite/heap/heap_memory_used.reject
|
|
@@ -17,13 +17,13 @@
|
|
insert into t1 values(1);
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-65504 131040
|
|
+32736 65504
|
|
drop table t1;
|
|
CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000;
|
|
insert into t1 values(1);
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-16352 32736
|
|
+16352 16352
|
|
drop table t1;
|
|
create table t1 (c1 int, index(c1)) engine=heap max_rows=10000;
|
|
insert into t1 select rand(100000000);
|
|
@@ -39,17 +39,17 @@
|
|
insert into t1 select rand(100000000) from t1 limit 488;
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-32704 32704
|
|
+16352 16352
|
|
insert into t1 select rand(100000000) from t1 limit 1;
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-32704 32704
|
|
+16352 16352
|
|
insert into t1 select rand(100000000) from t1 limit 1000;
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-49056 65408
|
|
+32704 32704
|
|
insert into t1 select rand(100000000) from t1;
|
|
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
|
data_length index_length
|
|
-81760 114464
|
|
+49056 65408
|
|
drop table t1;
|