Skip to content
TimescaleDB - Timeseries database for PostgreSQL
  • Timescale.com
  • Try for free
Getting started
Use Timescale
Tutorials
Code quick starts
API Reference
Migrate
Other deployment options
Self-hosted TimescaleDB
Install TimescaleDB
Configuration
Backup and restore
Migrate to self-hosted TimescaleDB
Manage storage using tablespaces
Multi-node
Distributed hypertables
About distributed hypertables
Create distributed hypertables
Insert data
Query data
Alter and drop distributed hypertables
Create foreign keys on distributed hypertables
Use triggers in distributed hypertables
Troubleshooting
Replication and High Availability
Additional tooling
Upgrade self-hosted TimescaleDB
Uninstall self-hosted TimescaleDB
Troubleshooting self-hosted TimescaleDB
Managed Service for TimescaleDB
About Timescale
Find a docs page
Self-hosted TimescaleDBDistributed hypertables

Create foreign keys in a distributed hypertable

Tables and values referenced by a distributed hypertable must be present on the access node and all data nodes. To create a foreign key from a distributed hypertable, use distributed_exec to first create the referenced table on all nodes.

Creating foreign keys in a distributed hypertable

  1. Create the referenced table on the access node.
  2. Use distributed_exec to create the same table on all data nodes and update it with the correct data.
  3. Create a foreign key from your distributed hypertable to your referenced table.

Keywords

distributed hypertableforeign keys

Found an issue on this page?

Report an issue!
PreviousAlter and drop distributed hypertablesNextUse triggers in distributed hypertables

Related Content

Distributed hypertables
Distributed hypertables help you horizontally scale your data storage in multi-node clusters
Query data in distributed hypertables
How to query data in distributed hypertables
Insert data
How to insert data into distributed hypertables
Use triggers on distributed hypertables
How to set up triggers on a distributed hypertable
About distributed hypertables
Learn how distributed hypertables work in multi-node Timescale
Create distributed hypertables
Create a distributed hypertable in a multi-node Timescale instance