Conversation
…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>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch reduces the memory footprint of
SHOW SLAVE STATUSand some other information schema queries by changing the type of 13 columns fromVARCHARtoBLOB.SHOW SLAVE STATUS / SHOW ALL SLAVES STATUS / INFORMATION_SCHEMA.SLAVE_STATUSare all served from theST_FIELD_INFOarrayslave_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-argumentVarchar()helper, which defaults toMAX_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
VARCHARtoBLOB.mysql-test/suite/funcs_1/r/is_columns_is.resultis updated to match, since it asserts onINFORMATION_SCHEMA.COLUMNSmetadata for these columns.