ERD Diagram
Visualize table relationships as an interactive SVG diagram in tpaw.
The ERD (Entity Relationship Diagram) renders all tables in a schema as an interactive SVG diagram. Each table appears as a node with its column list, with foreign key relationships drawn as curved edge paths between them. You can drag nodes to rearrange the layout.
Opening the ERD
Click View Diagram on a schema in the database browser to open the ERD for that schema. When opened from a schema detail view, the diagram is filtered to show only the tables in that schema.
The toolbar at the top shows the schema name (or "Schema Diagram" if no filter is applied), along with a count of tables and relations.
Table nodes
Each table is rendered as a rectangular node with:
- A header containing the table name
- A column list with one row per column, showing:
- A
PKprefix for primary key columns - An
FKprefix for foreign key columns - The column name
- The data type (right-aligned)
- A
Nodes are sized automatically to fit all columns.
Foreign key edges
Foreign key relationships are drawn as curved Bézier paths connecting the FK column in one table to the referenced column in another. Edges are rendered behind the table nodes so they don't obscure column details.
The edge routing logic handles multiple cases:
- When source and target tables are side by side, the edge connects the right edge of the source to the left edge of the target (or vice versa)
- When tables are vertically stacked, the edge exits through the bottom or top center
- When tables overlap, the edge routes around the right side to avoid passing through node bodies
Dragging nodes
Click and drag any table node to reposition it. This is useful for large schemas with many cross-linked tables — drag nodes apart to reduce edge crossings and clarify the relationship structure. Node positions are not persisted between sessions.
Schema-filtered view
When opened from a schema detail page, the ERD only includes tables from that schema. Cross-schema foreign keys pointing to tables outside the current filter are still drawn as edges, but the referenced table node may not be present in the diagram if it belongs to a different schema.
Performance notes
For large schemas, tpaw fetches table details in parallel batches of 20. The diagram renders once all table schemas are loaded. Very large schemas (hundreds of tables) may take a moment to load before the SVG appears.