citus_docs icon indicating copy to clipboard operation
citus_docs copied to clipboard

Tip for distributing tables with foreign keys

Open begriffs opened this issue 7 years ago • 1 comments

Communication goals (e.g. detailed howto vs orientation)

Citus does not support adding foreign keys between local and distributed tables. It does support distributing the target table for an existing foreign key. It does not allow distributing the source table for an existing foreign key. Thus the easiest way to avoid getting tangled up in dependencies is to distribute all tables first, and add foreign keys later.

Good locations for content in docs structure

  • Update http://docs.citusdata.com/en/v7.5/develop/reference_ddl.html#adding-removing-constraints
  • See whether the note needs updating in http://docs.citusdata.com/en/v7.5/develop/reference_ddl.html#distributing-coordinator-data

begriffs avatar Aug 08 '18 21:08 begriffs

Question for SE: have we considered marking the FKs as "NOT VALID" prior to distribution, and running "VALIDATE CONSTRAINT" afterward? That's a pg feature made available in 8.1

begriffs avatar Jan 10 '19 19:01 begriffs