Help › Work with results
Compare two results
See which rows a change to a query added, removed or changed, by comparing a result with the previous run's or with any other result.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
Compare two results to see what a change did to the rows: which rows only the first result has, which only the second has, and which values changed. Nothing runs again and nothing is read from a server: the rows already loaded in your tabs are compared, side by side, in a comparison tab.
To compare two tables, read whole on their servers, see Compare the data of two tables. To compare the same statement's rows on two connections in one result, see Run one query on several connections.
Compare with the previous run
When you run a statement again in a query tab or a table tab, the tab keeps the result of the run before, with the rows it had loaded. So after changing a query (a new WHERE, another join), you can see what the change did:
- Run the query, change it, and run it again.
- Choose Compare in the results toolbar (, also and the tab's right-click menu).
The previous run is on the left, the last run on the right. When a run returned several results, the result shown is compared with the same result of the previous run.
Only the run just before is kept, never older ones, and only while there is
room for it: its rows count against the result memory budget together with
the last run's. When the new rows need the room, the kept rows are let go
first, a message says so, and Compare says why it is not offered until
you run again. A run without a result (an UPDATE, an explain) is not
kept: the result before it stays. Closing the tab lets it go too.
Choose any two results
(also ) opens a dialog that lists every result of the open tabs: each result of each tab's last run (a run of several statements lists each one, and a run on several connections and the scratch's tabs count too), and each tab's previous run. Choose one result on the left and one on the right: click it, or use ↑ on macOS or Up on Windows and Linux and ↓ on macOS or Down on Windows and Linux in the list whose border is highlighted, and ← on macOS or Left on Windows and Linux and → on macOS or Right on Windows and Linux to move between the lists. Swap exchanges them; Compare or ↩ on macOS or Enter on Windows and Linux compares, and ⎋ on macOS or Esc on Windows and Linux closes the dialog.
The dialog starts on the current tab's previous and last runs when it has both, else on its two results, else on its result and the newest result of another tab. In a comparison tab, Change… beside either side opens the dialog again.
How rows are matched
Rows are matched in one of two ways, shown by Match by above the rows:
- By a key. When both results come from one table whose primary key (or a unique key whose columns cannot be NULL) they show, as the grid finds it for editing rows, rows are matched by it. Choose other columns under Match by: columns that look like a key of both results (never empty and never repeated in the rows loaded) are listed first and marked. Rows whose key repeats on a side are listed as Key repeats and never matched; rows with a NULL key match nothing and are counted apart.
- Whole rows. Two rows are the same when every column both results have holds the same value. Copies are counted, so a row three times on the left and once on the right is two rows More on left. Without a key, a changed row shows as a row only on the left and another only on the right. Choose Whole rows under Match by, or , to switch.
When no key is known for the two results, nothing is compared yet: the tab asks which columns identify a row. It offers Match on each column that looks like a key of both results, and Match Whole Rows; any other columns can be chosen under Match by. The comparison runs as soon as you choose, and the choice stays until you compare other results.
Columns are matched by name. A column only one result has is not compared, and a line names it; so does a column whose types differ, which is compared by what it holds. Values compare exactly as Querlyn holds them:
- decimals by exact value:
9.50and9.5are the same, never rounded; - floating-point numbers exactly as stored, so
0.1 + 0.2is not0.3; a line says so when a compared column holds them; - timestamps with a time zone as the same moment;
- NULL equals NULL, and only NULL (NULL and an empty string differ);
- text exactly: case and trailing spaces count.
Read the differences
The comparison tab is the one Compare the data of two tables uses. The line above the rows counts the rows of each side and the differences; rows that are the same are counted as Identical, not listed. The filters list All, Different (rows both have, with values that differ; not shown when whole rows are matched), Only Left and Only Right. A value that differs is highlighted.
Move with ↑ on macOS or Up on Windows and Linux and ↓ on macOS or Down on Windows and Linux; Next and Previous go to the next value that differs (F7, ⇧F7 on macOS or Shift+F7 on Windows and Linux). Compare Again (⌘R on macOS or Ctrl+R on Windows and Linux) takes both results as they are now, with any rows loaded since, and compares them again; Swap exchanges the sides.
To keep what you found:
- Copy () copies the differences the filter lists as tab-separated text with a header row: the status, the key, then each column's left and right value.
- Export… ()
writes the same rows to a file with the result exporter:
CSV, TSV, JSON, SQL
INSERTor Excel.
The first 10,000 differences are listed; every row is counted, and a line says when some were not listed.
Results that are not fully loaded
A result shows only the rows loaded so far (more load as you scroll). Only those rows are compared, and a line says so for each side ("Left: first 1,000 rows (more not loaded)").
- Load All () loads the rest of a result whose tab can still load more (its last run, waiting for more rows), then compares again. Loading stops at the result's memory budget; the line says so when it did.
- Compare on the Servers… () opens a data comparison of the two statements, matched by the same key: each runs again on its server, ordered by the key, and every row is compared, with that comparison's own question before it reads a Production table. Both statements read the data as it is now, so a change made to the data since the earlier run is on both sides. It is offered only when both results come from one statement that only reads, on one connection, without parameter values.
Nothing is ever run again unless you choose one of these.
No script for results
A comparison of tables can write the SQL that makes one table like the other. Results are not tables, so a comparison of results has no script, and its toolbar says so where the script buttons would be. To make one table like another, compare the tables: .
Masked columns
Values of masked columns stay masked on both sides, when either side masks the column, in the rows, in Copy and in Export…. They are still compared, so a difference in a masked column is marked without its value being shown. While screen-share mode is on, a merged result's Database column is masked too.
Help for Querlyn 0.1.0. All help topics