Postgresql – Efficiently query several one-to-zero-or-many relationships
The rough layout I have for some complex queries follows this table structure in Postgres: CREATE TABLE primari ( id BIGINT NOT NULL PRIMARY KEY, name TEXT NOT NULL ); CREATE TABLE secondary ( primary_id BIGINT NOT NULL references primari…