Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ff14b58d
Commit
ff14b58d
authored
May 23, 2019
by
Shinya Maeda
Committed by
Marcia Ramos
May 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add note for index requirement with FK constraint
Update migration_style_guide.md
parent
26d608cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
doc/development/migration_style_guide.md
doc/development/migration_style_guide.md
+5
-1
No files found.
doc/development/migration_style_guide.md
View file @
ff14b58d
...
@@ -186,7 +186,11 @@ end
...
@@ -186,7 +186,11 @@ end
When adding a foreign-key constraint to either an existing or new
When adding a foreign-key constraint to either an existing or new
column remember to also add a index on the column.
column remember to also add a index on the column.
This is _required_ for all foreign-keys.
This is
**required**
for all foreign-keys, e.g., to support efficient cascading
deleting: when a lot of rows in a table get deleted, the referenced records need
to be deleted too. The database has to look for corresponding records in the
referenced table. Without an index, this will result in a sequential scan on the
table which can take a long time.
Here's an example where we add a new column with a foreign key
Here's an example where we add a new column with a foreign key
constraint. Note it includes
`index: true`
to create an index for it.
constraint. Note it includes
`index: true`
to create an index for it.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment