Querious Docs

Schema Relationships

Exploring how the tables in a schema fit together as a graph.

Select a schema in the sidebar with the Structure view active to see its tables as a graph: each table is a node, and foreign keys are the edges between them. Use it to understand how a schema fits together.

The Graph #

  • Primary keys and foreign keys are marked with (P) and (F) icons next to the fields.
  • An arrow points from the table with the foreign key to the table with the primary key it references.
The controls of the Schema Relationships view

Laying out relationships diagrams like this, grouping related tables and completely avoiding tricky edge crossings, is impossible. Frankly, sometimes it's a real big mess. This is why Querious lets you choose from multiple layout options, spacing options, it lets you focus on neighbors of a single table, and you can even customize the layout by manually moving tables around.

Take the time to familiarize yourself with all of the options.

# Control
1 A table. Click to select it, drag to move it, double-click to focus on it.
2 Table list. Select a table to find it in the graph. Double-click to focus on it.
3 Layout menu. Arranges the graph, chooses what it shows, and exports it as a PDF, etc
4 Zoom slider. Zooms between 25% and 100%.
5 Minimap. Shows the whole graph, and the part of it that is visible.

Moving Around the Graph #

  • Select a table by clicking it in the graph or in the sidebar's table list. Its relationships are highlighted and unrelated tables fade back.
  • Drag a table to move it. Querious remembers where you put tables for each schema.
  • Right-click a table and choose Go To to open that table in the Content view.
  • Scroll to move around a large graph.

Zooming #

The Layout menu and zoom slider at the bottom of the graph

The zoom slider at the bottom of the graph zooms between 25% and 100%. Use the small magnifier icons at either end to step out or in, or drag the slider.

You can also zoom with a pinch gesture on a trackpad, and the slider follows along.

A schema with many tables is easiest to read zoomed out for the big picture, then zoomed back in on the area you care about. For a really big schema, focusing on a table is often easier than zooming.

Focusing on a Table #

A schema with dozens of tables can turn into a tangle of lines. Focus simplifies it by showing only one table and the tables directly connected to it by a foreign key, in either direction.

  1. Double-click a table in the graph or in the sidebar's table list to focus on it.
A focused graph, with the Show All Tables button in the upper left

While focused, the graph is arranged again just for that table, and a Show All Tables button appears in the upper left.

To get back to the full graph:

  • Click Show All Tables.
  • OR press Escape.

The full graph returns with your tables where you left them.

The Layout menu's layout and spacing choices are remembered separately for the full graph and for focused graphs, so you can use a different arrangement for each.

Layout Menu #

The Layout menu at the bottom left of the graph controls how the graph is arranged and what it shows.

Item What It Does
Arrange Tables Arranges all of the tables again from scratch, discarding any moving you did by hand.
Layout Chooses the arrangement algorithm. See below.
Show Tables with No Relationships Shows or hides tables that have no foreign keys to or from any other table. Hiding them can clear a lot of clutter from the graph.
Show All Fields Shows every column in each table.
Show Only Key Fields Shows only the columns that are part of a primary key or foreign key. This is the default.
Show Field Types Shows or hides the data type on the right of each column.
Export as PDF… Saves the graph as a PDF. See Exporting as PDF.

Show All Fields and Show Only Key Fields are exclusive of each other. Choosing the one that is already on turns it off, so that tables show only their names.

Your choices of what to show are remembered, and apply to every schema.

Layout Options #

The Layout submenu chooses how tables are positioned:

Layout Description
Force Directed The default. Related tables are pulled toward each other and unrelated tables are pushed apart, which tends to group tables into clusters by how connected they are.
Grid Spread Tables are placed in an evenly spaced grid.
Layered Tables are placed in layers that follow the direction of the foreign keys.

The Spacing slider in the same submenu adjusts how far apart tables are placed. Spread them out to give lines more room, or pull them together to see more at once.

Changing the layout or spacing arranges the tables again, so any tables you moved by hand are put back.

Exporting as PDF #

Choose Export as PDF… from the Layout menu to save the graph as a PDF file, named after the schema by default. The PDF contains the entire graph, not only the part that is visible on screen, and it has no selection highlight.

What is exported is what the graph is showing, so focus on a table first to export just that table and its neighbors, and use the Layout menu options to choose which tables and fields are included.