citusdata / citusdata/citus

Reduce overhead of building foreign constraint graph

Open
#7,581 1 comment 0 reactions 0 assignees View on GitHub
performance schema-based-sharding
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

Currently on every foreign key change, each backend has to rebuild their foreign key graph. This can be quite some overhead when using schema based sharding with many tables and many constraints, because we do a sequence scan over pg_constraint.

Two ideas on how to improve this:
1. Lazily build the parts of the graph that are needed. For schema based sharding it's expected that there are many small and completely disjoint graphs (one for each schema/colocation group). It does not make much sense to build all these little graphs, if you're only interested in the graph for a single schema.
2. Don't invalidate the full graph on a foreign key change. I'm not sure if this is even really possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.