Skip to content

MDEV-40018: SHOW SLAVE STATUS allocates ~1.7 MB per call due to overized VARCHAR columns - #5804

Open
plampio wants to merge 1 commit into
12.3from
12.3-MDEV-40018
Open

plampio wants to merge 1 commit into
12.3from
12.3-MDEV-40018

Conversation

@plampio

@plampio plampio commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This patch reduces the memory footprint of SHOW SLAVE STATUS and some other information schema queries by changing the type of 13 columns from VARCHAR to BLOB.

SHOW SLAVE STATUS / SHOW ALL SLAVES STATUS / INFORMATION_SCHEMA.SLAVE_STATUS are all served from the ST_FIELD_INFO array slave_status_info[]. Thirteen of its columns (Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Ignore_Server_Ids, Gtid_IO_Pos, Replicate_Do_Domain_Ids, Replicate_Ignore_Domain_Ids, Slave_SQL_Running_State, Replicate_Rewrite_DB, and Gtid_Slave_Pos) used the no-argument Varchar() helper, which defaults to MAX_FIELD_VARCHARLENGTH/3 characters. With utf8mb3, that reserves 65532 bytes per column in the temporary table's record buffer regardless of the actual value size, and the record is allocated twice, accounting for the reported ~1.7 MB allocated on every call.

Change these columns to Blob(MAX_FIELD_VARCHARLENGTH), which keeps the same maximum capacity but stores only a pointer and length in the record. Values, NULL-ability, and column order are unchanged; the client-visible column type for these columns changes from VARCHAR to BLOB.

mysql-test/suite/funcs_1/r/is_columns_is.result is updated to match, since it asserts on INFORMATION_SCHEMA.COLUMNS metadata for these columns.

…ized VARCHAR columns

SHOW SLAVE STATUS / SHOW ALL SLAVES STATUS / INFORMATION_SCHEMA.SLAVE_STATUS
are all served from the ST_FIELD_INFO array slave_status_info[]. Thirteen of
its columns (Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table,
Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table,
Replicate_Ignore_Server_Ids, Gtid_IO_Pos, Replicate_Do_Domain_Ids,
Replicate_Ignore_Domain_Ids, Slave_SQL_Running_State, Replicate_Rewrite_DB,
and Gtid_Slave_Pos) used the no-argument Varchar() helper, which defaults to
MAX_FIELD_VARCHARLENGTH/3 characters. With utf8mb3, that reserves 65532
bytes per column in the temporary table's record buffer regardless of the
actual value size, and the record is allocated twice, accounting for the
reported ~1.7 MB allocated on every call.

Change these columns to Blob(MAX_FIELD_VARCHARLENGTH), which keeps the same
maximum capacity but stores only a pointer and length in the record. Values,
NULL-ability, and column order are unchanged; the client-visible column type
for these columns changes from VARCHAR to BLOB.

mysql-test/suite/funcs_1/r/is_columns_is.result is updated to match, since
it asserts on INFORMATION_SCHEMA.COLUMNS metadata for these columns.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@plampio
plampio requested a review from bnestere October 1, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants