-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61127: sql: fix inefficient memory usage for SHOW CREATE ALL TABLES r=rafiss a=RichardJCai crdb_internal.show_create_all_tables is now a generator that returns create / alter statements row by row. The id sort is now done on only the table ids. The topological sort is done using a map of int64 -> int64 meaning the tableMetadata is no longer kept in ram during the sort. Memory is now proportional to the number of tables in the database. The amount of memory used in this builtin for storing table ids is the same as the amount of memory needed when generating the underlying crdb_internal.create_statements. This is technically still not constrained so we should make it clear that the command should not be run on dbs with an excessive number of tables. Release justification: fix for inefficient memory usage, low risk, builtin currently not in release version of crdb Release note (sql change): SHOW CREATE ALL TABLES is updated to be more memory efficient, however this should still not be run on a database with an excessive number of tables. Users should not run this on a database with more than 10000 tables (arbitrary but tested number) Co-authored-by: richardjcai <[email protected]>
- Loading branch information
Showing
11 changed files
with
617 additions
and
455 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.