Merge lp:~wgrant/launchpad/gpgkey-fks-db-hack-the-catalog into lp:launchpad/db-devel
Status: | Merged |
---|---|
Merged at revision: | 13357 |
Proposed branch: | lp:~wgrant/launchpad/gpgkey-fks-db-hack-the-catalog |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
64 lines (+26/-5) 1 file modified
database/schema/patch-2209-75-0.sql (+26/-5) |
To merge this branch: | bzr merge lp:~wgrant/launchpad/gpgkey-fks-db-hack-the-catalog |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | db | Approve | |
Review via email: mp+288480@code.launchpad.net |
Commit message
Avoid table scans for fingerprint CHECK constraints by hacking the catalog.
Description of the change
Avoid table scans for fingerprint CHECK constraints by hacking the catalog.
Pre-validating the constraints is slow (full table scan), and ALTER TABLE ...
VALIDATE CONSTRAINT before 9.4 takes a very unpleasant ACCESS EXCLUSIVE lock,
so we seem to be stuck with minutes of downtime. But we know that the columns
are new and null, so the constraints are definitely satisfied at this point.
Manually hack them to validated in pg_catalog.
Verified with "pg_dump --schema pg_catalog launchpad_dev" and the test suite
that convalidated is the only change and the server doesn't do anything
silly like crashing.
Yes, I just changed a DB patch that was already on staging. Edgy.