Skip to content

Keep and compare results

A run replaces the tab’s results. A result you pin stays beside the new ones, to look back at or to compare with. You can also keep a result on the server as a temporary table, show a script’s results one under another, and hide the results pane to give the editor the room.

Right-click a result tab, such as Data Output, in a Query Tool tab. A data tab’s result tab has no menu: its rows are the table’s, read again on every run.

The right-click menu of the Data Output 1 tab: Pin This Result, Rename, Compare with (its submenu shows Data Output 2), Chart, Keep as Temp Table, Results Stacked, like SSMS, and Hide Results Pane.The right-click menu of the Data Output 1 tab: Pin This Result, Rename, Compare with (its submenu shows Data Output 2), Chart, Keep as Temp Table, Results Stacked, like SSMS, and Hide Results Pane.

Compare with, Chart and Keep as Temp Table show once the result has all its rows. For a result of Run on several databases, the menu also has Compare Databases.

Right-click a result tab and choose Pin This Result. The tab gets a pin. When the tab runs again, the pinned result is kept and stands first in the strip, before the results of the new run.

The result tabs after a second run: a pinned tab named Before with 50 after its name, then Data Output, Messages and History.The result tabs after a second run: a pinned tab named Before with 50 after its name, then Data Output, Messages and History.
  • 1 A result kept from an earlier run: the pin, its name and how many rows it has. Until you rename it, it is named by when it ran, for example Run at 14:02, with the time as your computer writes times.
  • 2 The result of the run you made last.

What to know about pinned results:

  • A pinned result is a snapshot, and read-only from the moment you pin it. Its tag says “Pinned results are snapshots. Run the query again to edit current rows.” You can read it, copy it, export it, chart it and compare it.
  • A tab keeps up to ten. Pinning an eleventh says “Up to 10 results are kept: unpin one first.”
  • Unpin This Result lets one go. A result from an earlier run goes at once; a result of the last run goes with the next run.
  • The rows stay in pgjumbo’s engine with the tab’s session. Closing the tab, or moving it to another database, lets them go.
  • When the tab’s session is lost, its pinned results stay in the strip, and the banner says so (“Your pinned result is kept here, read-only:” and its name). Reconnect brings them along to the new session, so they can still be compared. The banner is explained on A tab’s session.

Right-click a result tab and choose Rename…, or double-click the tab. Type the name and press Enter; Esc leaves the name as it was. An empty name gives the result its own name back.

Any result can be renamed, pinned or not. A name helps most on a result you pin: Before says more than Run at 14:02 when you compare later. A long name is cut with “…” in its tab; hover over the tab to read all of it.

Compare lists what differs between two results: the rows only in the first, the rows only in the second, and the rows that changed, cell by cell. The usual way to use it:

  1. Run the query and pin its result. Rename it if you like, for example to Before.
  2. Change something: the data, or the query itself.
  3. Run again.
  4. Right-click the new result’s tab, choose Compare with, and pick the pinned result.

Compare with names the tab’s other results, the pinned ones first. The comparison opens in a Compare tab beside the results. For results from different runs, the older one is “before” and the newer one “now”, whichever tab you start from.

The Compare tab for Before with Data Output: matched on id, the primary key, 1 only before, 0 only now, 1 changed, 48 the same, hidden. Under it a Changed row shows 19.50 → 21.50 in total on a yellow tint, and an Only before row is tinted red.The Compare tab for Before with Data Output: matched on id, the primary key, 1 only before, 0 only now, 1 changed, 48 the same, hidden. Under it a Changed row shows 19.50 → 21.50 in total on a yellow tint, and an Only before row is tinted red.
  • 1 The Compare tab. It keeps its rows after the results it came from are gone, until you compare again.
  • 2 Which two results were compared, the one before first.
  • 3 What the rows were matched on: see the table below.
  • 4 The counts: rows only before, rows only now, rows that changed, and the rows that are the same, which are counted and not listed.
  • 5 A changed cell reads old → new on a yellow tint. The row is marked Changed, and its other cells show the value both sides have.
  • 6 A row that is Only before is tinted red; a row that is Only now is tinted green.

How rows are matched:

The header says When What it means for a changed row
Matched on id (the primary key) The columns come from one table and the results hold its primary key The two rows with the same key are compared cell by cell.
Matched on … (a unique index) There is no primary key, but a unique index over NOT NULL columns The same, on that index’s columns.
Matched on every column Neither was found A row matches only a row that is the same in every column, so a changed row shows as one gone and one come. A line under the header says so.

More to know:

  • pgjumbo’s engine works the comparison out over the rows each result holds, as the server sent them. The grid’s sort and filter do not apply.
  • Columns only one side has are left out of the comparison, and a line under the header names them (Only before, left out: …, Only now, left out: …).
  • The first 2,000 rows that differ are listed, and a line says so when there are more. The counts are of every row.
  • A NULL shows as your NULL reads word (see How values look).
  • When nothing differs, the tab says “Every row is the same.” When the comparison cannot be made, it says which results “could not be compared” and why.

A result of Run on several databases holds the rows of every database, with the server and the database in its first two columns. Its tab’s menu has Compare Databases, which compares one database’s rows with another’s.

The right-click menu of a result from three databases with Compare Databases open: Local demo / postgres with Local demo / shop, Local demo / postgres with Local demo / tenant_001, and Local demo / shop with Local demo / tenant_001.The right-click menu of a result from three databases with Compare Databases open: Local demo / postgres with Local demo / shop, Local demo / postgres with Local demo / tenant_001, and Local demo / shop with Local demo / tenant_001.
  • 1 Compare Databases in the result tab’s menu.
  • 2 The databases two by two, each named as server / database. Past ten pairs, the menu offers each database against the first instead.

The comparison opens in the same Compare tab and reads the same way: the first database of the pair is “before”, the second “now”. This is how you compare one query’s rows on Staging and on Production.

Right-click a result tab and choose Keep as Temp Table. pgjumbo copies the rows the result holds into a temporary table on the tab’s own session, so your next query in that tab can join it. Nothing runs again.

Messages after Keep as Temp Table: under the statement's entry, an entry Kept as a temporary table says pg_temp.r1 holds Data Output's 50 rows; the next query can join it. It goes when the session does.Messages after Keep as Temp Table: under the statement's entry, an entry Kept as a temporary table says pg_temp.r1 holds Data Output's 50 rows; the next query can join it. It goes when the session does.
  • 1 Messages comes to the front with an entry that names the table and says when it goes. The result bar says Kept as pg_temp.r1 for a few seconds.

About the table:

  • The first is pg_temp.r1, the next pg_temp.r2, and so on. Use it by that name: SELECT … FROM orders JOIN pg_temp.r1 USING (id).
  • Each column keeps its name and its type as the server writes it. A name that comes twice gets _2, and a column without a name is called column_3, by its place.
  • It holds every row the result holds, whatever the grid’s sort and filter show. Rows past the row cap were never read, so they are not in it, and the entry says how many: see Large results.
  • It goes when the tab’s session ends: when you close the tab, move it to another database, or lose the connection. Made while a transaction is open, it is part of that transaction: a rollback takes it back.
  • Other tabs have their own sessions and cannot see it.

pgjumbo refuses, and says why in the result bar, when the session is read-only (PostgreSQL makes no table in a read-only transaction, not even a temporary one), when the tab’s transaction has failed and must be rolled back first, and while a rehearsal is waiting. Keeping what a rehearsed write would change is on Rehearse a write.

A script that returns several results gets a tab for each. To see them all at once, as SQL Server Management Studio shows them, turn stacking on in one of these ways:

  • Right-click a result tab and choose Results Stacked, like SSMS.
  • Choose QueryResults Stacked.
  • Choose Results Stacked in the toolbar’s More (…) menu.

The item is ticked while stacking is on; choose it again to go back to one result at a time.

A script of two statements with its results stacked: Data Output 1 with 12 rows and its own grid, outlined, and under it Data Output 2 with 50 rows and its own grid.A script of two statements with its results stacked: Data Output 1 with 12 rows and its own grid, outlined, and under it Data Output 2 with 50 rows and its own grid.
  • 1 Each result has a line with its name and its number of rows, and a grid of its own under it. The one with the outline is the result in front: the result bar and the status bar speak of it.
  • 2 The next result. Click in a result to bring it to the front. The pane scrolls when the results do not fit.

What to know:

  • Stacking is one choice for every Query Tool tab of the window, and it is kept when you restart pgjumbo. It shows whenever a run returned more than one result and a result tab is in front.
  • Each stacked grid sorts, sizes and arranges its columns, and copies, like the single grid. Editing rows and following a foreign key need the single grid: turn stacking off for those.
  • The item is greyed out while the tab shows its results as text, which shows one result at a time.

To give the editor the whole tab, hide the results:

  • Right-click a result tab and choose Hide Results Pane.
  • Or choose QueryHide Results Pane, or the same item in the toolbar’s More (…) menu. There it is ticked while the pane is hidden; choose it again to show the pane.

The pane comes back by itself with the next run. Hiding is for the tab in front only.

pgjumbo’s own shortcuts give it no key. The SSMS set of shortcuts does: ⌘ R (Ctrl+R on Windows and Linux). See Change the shortcuts.