Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workload/tpcc: avoid validating foreign keys after dataset generation #38834

Merged

Conversation

nvanbenschoten
Copy link
Member

Foreign key validation was adding a significant amount of time to the initialization of TPC-C. This was especially true on very large datasets. This commit uses the new (as of #38663) ability to create Foreign Key constraints in the Unvalidated state using the NOT VALID syntax to avoid this extra work.

This will work with old versions of CockroachDB as well because the NOT VALID syntax has been around for a very long time, it was just ignored up until #38663.

Release note: None

Foreign key validation was adding a significant amount of time to
the initialization of TPC-C. This was especially true on very large
datasets. This commit uses the new (as of cockroachdb#38663) ability to create
Foreign Key constraints in the Unvalidated state using the NOT VALID
syntax to avoid this extra work.

This will work with old versions of CockroachDB as well, because the
NOT VALID syntax has been around for a very long time, it was just
ignored up until cockroachdb#38663.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten
Copy link
Member Author

bors r=danhhz

craig bot pushed a commit that referenced this pull request Jul 11, 2019
38834: workload/tpcc: avoid validating foreign keys after dataset generation r=danhhz a=nvanbenschoten

Foreign key validation was adding a significant amount of time to the initialization of TPC-C. This was especially true on very large datasets. This commit uses the new (as of #38663) ability to create Foreign Key constraints in the `Unvalidated` state using the `NOT VALID` syntax to avoid this extra work.

This will work with old versions of CockroachDB as well because the `NOT VALID` syntax has been around for a very long time, it was just ignored up until #38663.

Release note: None

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
@craig
Copy link
Contributor

craig bot commented Jul 11, 2019

Build succeeded

@craig craig bot merged commit facc618 into cockroachdb:master Jul 11, 2019
@danhhz
Copy link
Contributor

danhhz commented Jul 12, 2019

Follow up Q: my mental model of this is that after fixtures import finishes, normal INSERT/UPDATE/DELETES writes to these tables still get FK checks. it's only the data in the table at the time of FK addition that doesn't get checked. is that right?

@thoszhang
Copy link
Contributor

@danhhz yes, that's correct

@danhhz
Copy link
Contributor

danhhz commented Jul 12, 2019

Perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants