Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8, 12.3
-
Related to performance
Description
While reviewing MDEV-37070, I paid attention to sizeof(dict_index_t). It turns out to contain quite a bit of bloat. I experimented with GDB:
ptype/o dict_index_t
|
and came up with the following tweaks:
- Reduce the size of trx_id_offset from 12 to 9 bits. If there is a fixed-length PRIMARY KEY that is longer than 511 bytes, let us treat it as variable-length. Extremely long primary keys are a bad idea anyway.
- Move uncommitted and n_core_null_bytes right after trx_id_offset to completely fill the 32-bit unsigned word.
- Move cached and to_be_dropped after n_def to fill the word: 10+10+10+1+1=32.
- Change ahi::ref_count (the number of covered index leaf pages in the buffer pool) from size_t to uint32_t. The number of index pages must fit in that quantity, because all pages of an index must be in the same tablespace, and the page numbers are 32-bit.
- Remove zip_pad_info_t::mutex and use dict_table_t::lock_latch instead. This is only needed in the rarely invoked functions dict_index_zip_success() and dict_index_zip_failure().
- Replace search_info with a union of ahi and some rtr fields. Note that root_guess must be kept outside the union; it’s also being used for accessing SPATIAL INDEX pages.
- Inside the union, replace rtr_info_track_t with an intrusive list of rtr_info. Use dict_table_t::lock_latch instead of a dedicated mutex.
With these small tweaks, we can shrink sizeof(dict_index_t) from 288 (0x120) to 224 (0xe0) bytes, saving 22%, not counting the savings for SPATIAL INDEX.
Attachments
Issue Links
- relates to
-
MDEV-37070 Implement table options to enable/disable features
-
- Approved
-