# Database guides

> 原文：[https://docs.gitlab.com/ee/development/database/](https://docs.gitlab.com/ee/development/database/)

*   [Database Reviews](#database-reviews)
*   [Tooling](#tooling)
*   [Migrations](#migrations)
*   [Debugging](#debugging)
*   [Best practices](#best-practices)
*   [Case studies](#case-studies)

# Database guides[](#database-guides "Permalink")

## Database Reviews[](#database-reviews "Permalink")

*   如果您要创建数据库 MR 进行审查，请查看我们的[数据库审查指南](../database_review.html) .

    它介绍了与数据库相关的更改，迁移和复杂的 SQL 查询.

*   如果您是数据库审阅者或想成为一名数据库审阅者，请查看我们的数据库审阅[简介](database_reviewer_guidelines.html) .

## Tooling[](#tooling "Permalink")

*   [Understanding EXPLAIN plans](../understanding_explain_plans.html)
*   [explain.depesz.com](https://explain.depesz.com/)或[explain.dalibo.com，](https://explain.dalibo.com/)用于可视化`EXPLAIN`的输出
*   [pgFormatter](http://sqlformat.darold.net/) PostgreSQL SQL 语法美化器

## Migrations[](#migrations "Permalink")

*   [What requires downtime?](../what_requires_downtime.html)
*   用于 SQL 查询的[SQL 准则](../sql.html)
*   用于创建安全的 SQL 迁移的[迁移样式指南](../migration_style_guide.html)
*   [Testing Rails migrations](../testing_guide/testing_migrations_guide.html) guide
*   [Post deployment migrations](../post_deployment_migrations.html)
*   [Background migrations](../background_migrations.html)
*   [Swapping tables](../swapping_tables.html)
*   [Deleting migrations](../deleting_migrations.html)

## Debugging[](#debugging "Permalink")

*   使用带有[Marginalia 的](../database_query_comments.html)查询注释来跟踪 SQL 查询的源
*   使用[详细查询日志](https://guides.rubyonrails.org/debugging_rails_applications.html#verbose-query-logs)在 Rails 控制台中跟踪 SQL 查询的源

## Best practices[](#best-practices "Permalink")

*   [Adding database indexes](../adding_database_indexes.html)
*   [Foreign keys & associations](../foreign_keys.html)
*   [Adding a foreign key constraint to an existing column](add_foreign_key_to_existing_column.html)
*   [`NOT NULL` constraints](not_null_constraints.html)
*   [Strings and the Text data type](strings_and_the_text_data_type.html)
*   [Single table inheritance](../single_table_inheritance.html)
*   [Polymorphic associations](../polymorphic_associations.html)
*   [Serializing data](../serializing_data.html)
*   [Hash indexes](../hash_indexes.html)
*   [Storing SHA1 hashes as binary](../sha1_as_binary.html)
*   [Iterating tables in batches](../iterating_tables_in_batches.html)
*   [Insert into tables in batches](../insert_into_tables_in_batches.html)
*   [Ordering table columns](../ordering_table_columns.html)
*   [Verifying database capabilities](../verifying_database_capabilities.html)
*   [Database Debugging and Troubleshooting](../database_debugging.html)
*   [Query Count Limits](../query_count_limits.html)
*   [Creating enums](../creating_enums.html)

## Case studies[](#case-studies "Permalink")

*   [Database case study: Filtering by label](../filtering_by_label.html)
*   [Database case study: Namespaces storage statistics](../namespaces_storage_statistics.html)