Help › Run queries

Search the query history

Search the statements you ran, open, insert or run one again, and choose what the history keeps for each connection.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

Querlyn keeps a history of what you ran in query tabs, and with the querlyn command, on this computer. It is the way back to a statement you did not save.

Open the history

Choose View › Show Query History (⇧⌘H on macOS or Ctrl+Shift+H on Windows and Linux), or the Query History button above the saved queries in the sidebar. A panel opens at the right of the window, newest entry first, with the keyboard in its search field.

Each entry shows when it ran, on which connection and database, how long it took, how it ended (Succeeded, Failed or Cancelled) and the SQL. A run of several statements is one entry.

Find an entry

  • Search: type words. An entry matches when its SQL contains every word, in any case.
  • Connection: All connections, or one.
  • Outcome: all, Succeeded, or Failed or cancelled.
  • Time: Any time, Last hour, Last 24 hours, Last 7 days or Last 30 days.

The panel shows 200 entries at a time; Load More shows the next 200 (Command Palette › Query: Load More History). Command Palette › Query: Refresh Query History reads the list again.

Use an entry

Select an entry and use the buttons under the list, the right-click menu, or these keys:

ToButtonKey in the list
Open its SQL in a new tab, without running itOpen↩ on macOS or Enter on Windows and Linux
Put its SQL at the cursor of the tab you were inInsert⇧↩ on macOS or Shift+Enter on Windows and Linux
Copy its SQLCopy⌘C on macOS or Ctrl+C on Windows and Linux
Run it againRun Again⌘↩ on macOS or Ctrl+Enter on Windows and Linux
Delete the entryDelete⌘⌫ on macOS or Delete on Windows and Linux
Close the panelClose⎋ on macOS or Esc on Windows and Linux

Run Again opens the SQL in a new tab on the entry's connection, in the database it ran in, and runs all of it as if you had pressed Run: on Production it asks first, as for any statement. If the connection no longer exists, the SQL is only opened. Open in New Tab puts the tab on the same database.

The history keeps statements, not their rows. To see what changed between two runs' rows, run the statement again in its tab and compare the result with the previous run's: see Compare two results.

What is recorded

Each connection has its own setting, Query history, in its dialog (Query › Edit Connection…):

Query historyWhat an entry holds
Full (including SQL)When, connection, database, duration, outcome, row count, and the SQL as you wrote it
Metadata onlyThe same, without the SQL
OffNothing: what you run on the connection leaves no entry

A connection starts with Full (including SQL), except a Production connection, which starts with Metadata only, because SQL can contain customer data. Changing a connection's Environment puts the setting back to what the new environment starts with.

An entry without SQL reads SQL not recorded on Production or says that the connection keeps metadata only. This goes by the setting the connection has now: after you change it away from Full (including SQL), the SQL of its earlier entries is no longer shown or searched, though it stays stored until you clear the history.

Such an entry offers Command Palette › Query: Record Statements for This Connection…, under the entry and on its right-click menu. It says what keeping the SQL means and, when you choose Record Statements, sets the connection's Query history to Full (including SQL): what you run on it from then on keeps its SQL. Entries recorded before stay as they were.

Never recorded:

  • The values of parameters. A statement is recorded with its placeholders.
  • Passwords and results. A run that sets a password or holds another credential (ALTER USER … PASSWORD '…', CREATE USER … IDENTIFIED BY …, SET PASSWORD, CREATE SECRET, MongoDB's pwd, a connection string with a password in it) is recorded without its SQL on every connection, as on Production. Its entry reads SQL not recorded: the statement sets a password, and if you sync your history, nothing of its SQL is synced either. Earlier versions of Querlyn recorded such runs whole. The first time this version starts it removes the SQL of those entries from the history on this computer, once, and says how many in a message; the entries stay, without their SQL. A password that was in the history is worth changing.
  • A run that Querlyn refused before it reached the database, such as a write on a read-only connection.
  • Explain and Explain Analyze, a dry run (running it again from the history would run it for real), the look-ups behind a referenced row, and what Querlyn runs for itself.
  • What you run in a scratch tab.

A statement you run on several connections is recorded once for each connection, as that connection keeps history.

What you run with the querlyn command is recorded the same way, by the connection's setting, and its entries say Command line. A run of a notebook's cells is one entry, with every statement of its cells, and says Notebook. An open history panel shows them when you come back to Querlyn's window, or with Command Palette › Query: Refresh Query History.

Remove history

  • Delete removes the selected entry at once, without asking.
  • Clear History… (Command Palette › Query: Clear Query History…) removes, after a question, the history of the connection chosen in the filter, or all of it when no connection is chosen.

Querlyn also removes old entries by itself, so that the history does not grow without end: entries older than 90 days, and the oldest ones beyond the newest 50,000. It does so when it starts, as you work, and once a day while it stays open. Save a statement you want to keep as a saved query.

The history stays on this computer unless you turn on syncing it, which is off by default; see Sync your computers. Clearing removes it from this computer only.

Help for Querlyn 0.1.0. All help topics