forked from greenplum-db/gpbackup-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move constraints back to postdata for data load performance
Originally, constraints were dumped in predata. This caused a restore issue with tables that used constraints that used the `NOT VALID` clause. This is because there were scenarios where there was data grandfathered into tables that violate the constraint that has not yet been resolved by users, but allowed because of the `NOT VALID` clause. Because of this issue, and the assumption that nothing can depend on constraints, constraints were moved from predata to postdata to allow tables with data that violate `NOT VALID` constraints to restore. greenplum-db/gpbackup@90b3b54 It was then later discovered that views can depend on constraints. All constraints, expect ones with `NOT VALID` clause, were moved back into predata. greenplum-db/gpbackup@5895076 While this fixes the dependency issues, this is a significant performance regression because it is much more performant to restore constraints after all data has been restored. This is because constraints use internal indexes. If constraints are restored during predata, data load would slow down considerably because every row insert would trigger constraint index update. In order resolve both the performance regression and original issue, we can move constraint restore back into postdata and resolve the circular dependency of a predata view depending on a postdata constraint using a dummy view in predata. Now if a view that depends on a constraint is detected, a dummy view that satisfies dependency conditions for other relations gets dumped in predata. The dummy view and will eventually get replaced by the dump of the full view definition in postdata after constraints are dumped. This circular dependency of predata views depending on postdata constraints does not exist on GPDB5. View dependency on constraints exist because of the feature to allow incomplete GROUP BY lists that was introduced in GPDB6 (postgres 9.1). This commit allows the parser to recognize functional dependency on primary keys. This allows a table's other columns to be referenced without listing them in GROUP BY, so long as the primary key column(s) are listed in GROUP BY. greenplum-db/gpdb@e49ae8d Co-authored-by: Karen Huddleston <khuddleston@vmware.com>
- Loading branch information
1 parent
3f36dd9
commit defa05d
Showing
19 changed files
with
429 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.