Skip to content

Commit 5942513

Browse files
authored
Clarify db index docs (#13561)
1 parent bf12012 commit 5942513

File tree

1 file changed

+3
-2
lines changed
  • develop-docs/backend/application-domains/database-migrations

1 file changed

+3
-2
lines changed

develop-docs/backend/application-domains/database-migrations/index.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ generally prefer that, since it averages the load out over a longer period of ti
135135

136136
### Indexes
137137

138-
We prefer to create indexes on large existing tables with `CREATE INDEX CONCURRENTLY`. Our migration framework will do this automatically when creating
139-
a new index. Note that when `CONCURRENTLY` is used we can't run the migration in a transaction, so it's important to use `atomic = False` to run these.
138+
These are automatically handled by the migration framework, you can just create them on the Django model and generate the migration.
140139

141140
When adding indexes to large tables you should use a `is_post_deployment` migration as creating the index could take longer than the migration statement timeout of 5s.
142141

142+
Note: These are created using `CONCURRENTLY`, so it's important to not set `atomic = True` for migrations that contain indexes. This is disabled by default.
143+
143144
### Deleting columns
144145

145146
This is complicated due to our deploy process. When we deploy, we run migrations, and then push out the application code, which takes a while. This means that if we just delete a column or model, then code in sentry will be looking for those columns/tables and erroring until the deploy completes. In some cases, this can mean Sentry is hard down until the deploy is finished.

0 commit comments

Comments
 (0)