gitlab-org--gitlab-foss/lib/gitlab/database
Yorick Peterse a97dcc077c
Add method for creating foreign keys concurrently
This method allows one to create foreign keys without blocking access to
the source table, but only on PostgreSQL.

When creating a regular foreign key the "ALTER TABLE" statement used for
this won't return until all data has been validated. This statement in
turn will acquire a lock on the source table. As a result this lock can
be held for quite a long amount of time, depending on the number of rows
and system load.

By breaking up the foreign key creation process in two steps (creation,
and validation) we can reduce the amount of locking to a minimum.
Locking is still necessary for the "ALTER TABLE" statement that adds the
constraint, but this is a fast process and so will only block access for
a few milliseconds.
2017-02-10 21:51:09 +01:00
..
date_time.rb fixing spec failures 2016-11-17 08:22:55 +01:00
median.rb refactor fetcher and fixed specs 2017-01-17 11:32:55 +01:00
migration_helpers.rb Add method for creating foreign keys concurrently 2017-02-10 21:51:09 +01:00