doc/development/database/large_tables_limitations.md
GitLab enforces some limitations on large database tables schema changes to improve manageability for both GitLab and its customers. The list of tables subject to these limitations is defined in rubocop/rubocop-migrations.yml.
The following limitations apply to table schema changes on GitLab.com:
| Limitation | Maximum size after the action (including indexes and column size) |
|---|---|
| Can not add an index | 50 GB |
| Can not add a column with foreign key | 50 GB |
| Can not add a new column | 100 GB |
These limitations align with our goal to maintain all tables under 100 GB for improved stability and performance.
Exceptions to these size limitations should only granted for the following cases:
int4 to int8To request an exception to these limitations:
schema_change_exception templateBefore requesting an exception, consider these approaches to manage table size:
smallint instead of integer when possible)NULL instead of empty strings or zerostext instead of varchar to avoid storage overheadConsider these alternatives when working with large tables:
id instead of created_at for sorting).Table size limitations provide several advantages:
For more information about data model trade-offs, see the database documentation.
has_one relationshipsWhen a table becomes too large for new columns, create a new table with a has_one relation. For example, in merge request !170371, we track the total weight count of an issue in a separate table.
Benefits of this approach:
This approach is particularly effective when:
Disadvantages