Skip to content

Query Tool guide

Action Shortcut / control
Execute the selection, or the whole script F5 or Ctrl/Cmd+Enter
Cancel the running statement the red Cancel button (replaces Execute while running)
Show the plan and detailed plan without running Explain
Comment or uncomment lines Ctrl/Cmd+/
Format the selection or the whole script Shift+Alt+F or Format
Find / replace Ctrl/Cmd+F
Autocomplete Ctrl+Space. Type alias. to get that table's columns (from artikel a and from "ARTIKEL" a both work). Names are quoted only when they must be: ARTIKEL and MON$DATABASE are inserted as they are, a reserved word or a case-sensitive name such as "MixedCase" in quotes

Parameters

:name and ? markers outside strings and comments prompt for values before the script runs. A name used several times is asked for once. Values are sent as text, and Firebird converts them to the target type. Tick NULL to send a NULL. Values are remembered in the browser for the next run.

Markers inside CREATE PROCEDURE/FUNCTION/TRIGGER/PACKAGE and in the body of an EXECUTE BLOCK are left alone, because there :var refers to PSQL variables. An EXECUTE BLOCK takes parameters in its input list:

execute block (XTERM varchar(200) = :SEARCH_TERM, XPREVIEW boolean = :PREVIEW_ONLY)
returns (TABLE_NAME varchar(63))
as begin
  /* :XTERM and :XPREVIEW here are the block's own variables */
end

Formatting

Format (Shift+Alt+F) formats the selection, or the whole script. It reads the script as Firebird does: SET TERM changes the terminator, and names may contain $ (RDB$RELATIONS). Plain statements are laid out with upper-case keywords. PSQL modules (EXECUTE BLOCK, CREATE PROCEDURE, FUNCTION, TRIGGER, PACKAGE) are kept as you wrote them.

Transactions

Each Query Tool tab has its own attachment and transaction.

  • Auto-commit on: each statement is committed when it succeeds. A failed statement is rolled back.
  • Auto-commit off: work stays in an open transaction (shown in the status bar) until you press Commit or Rollback, or run COMMIT; / ROLLBACK; in the script.
  • The settings menu (labelled with the current isolation) sets isolation, read-only, lock resolution (wait / no wait), lock timeout, and statement timeout (Firebird 4+). These can only change while no transaction is open.

Large results

The Rows setting limits the first fetch. When the last statement of a script returns more rows, its cursor stays open and Load more fetches the next page. The open cursor keeps its transaction alive. It is closed (and committed in auto-commit mode) when you run another statement, commit or roll back.

Fetch all (next to Load more) fetches every remaining row, 10,000 at a time; the row count grows as it goes, and Stop keeps the rows fetched so far. Rows: all executes and fetches all in one step. All fetched rows are kept in the browser, so mind the size of very large results.

Execute + Fetch all does it for one run, whatever the Rows setting: in the menu of the ▾ next to Execute, or with Shift and the execute keys (Shift+F5, Shift+Ctrl+Enter; configurable in the preferences). Use it for a reliable row count, to export or copy the complete result, or for statements that only finish when every row is fetched (an EXECUTE BLOCK that suspends rows while it updates).

The Messages tab shows the number of rows fetched so far ("3,000 row(s) fetched — more available"), updated by Load more and Fetch all; the time those took is shown as Fetched later and included in the total.

Exports are never silently partial. While the cursor is still open, the Export menu offers All rows, which fetches the rest first and then writes the complete result, or Only the N loaded rows. The grid's filter and sort apply to both.

Statistics

With Stats ticked, each statement shows the change in its attachment's counters in MON$IO_STATS and MON$RECORD_STATS: page fetches, reads, writes and marks, plus sequential and indexed record reads, inserts, updates, deletes, backouts, purges and expunges. These are a quick way to spot full table scans: compare Seq. reads with Index reads.

Plans

Explain (or F7) shows the classic plan plus the detailed plan. - Diagram draws the detailed plan as a tree, colour-coded by node type: red for full table scans, blue for table access, green for index access, amber for sort/aggregate/hash. - Text shows the raw plan text. - Pin plan, then change the query and Explain again. Compare with pinned then shows a line diff of the two plans, which is handy for checking that a new index is actually used.

Results

  • Drag a column header's right edge to resize the column; double-click the edge fits it to its contents.
  • Freeze keeps the first columns visible while you scroll sideways.
  • Export to CSV, TSV, JSON, SQL INSERT, Markdown or Excel (XLSX).

Selecting cells

The grid selects like a spreadsheet; the toolbar shows how many cells are selected.

Action Selects
Click a cell that cell
Shift+click, Shift+arrow keys, or drag the range from the active cell
Ctrl+click (Cmd on macOS) adds or removes a cell
Click a row number (Shift/Ctrl for more) whole rows
Alt+click a column header (a plain click sorts) the whole column
Click the # corner, or Ctrl+A in the grid everything

Copying

Copy copies the selection, or the whole result with its header row when at most one cell is selected. Ctrl+C copies the selection's values, Ctrl+Shift+C with the column names. The ▾ next to Copy offers:

  • Copy / Copy with headers: tab-separated, to paste into a spreadsheet;
  • Copy as IN list: the selected values as (3, 4, 6, 9) or ('A', 'O''Brien'): in order, each once, without NULLs, strings quoted and escaped, ready for WHERE ID IN …;
  • Copy as INSERT / UPDATE / UPDATE OR INSERT statements: one statement per row for the selected columns; the first selected column is the key of UPDATE … WHERE and of MATCHING, so select the key first. The table is the result's name when it is one, otherwise TABLE_NAME;
  • Copy as CSV, JSON or Markdown table.

With rows still to fetch, the copies take the loaded rows; Fetch all first for the complete result (exports offer that themselves).

Context menu

Right-click in the grid for Fetch all / Stop fetching, every copy format, Export, the Cell viewer, Select row / column / all, Best fit column / Best fit all columns and Freeze up to this column. It works on the selection, or on the clicked cell when that is outside the selection.

In the desktop app, right-click elsewhere (the SQL editor, text fields) shows the usual Cut / Copy / Paste menu; FBADMIN_DESKTOP_CONTEXT_MENU=0 turns it off.

BLOBs in the data editor

While editing a cell, the … button opens a larger editor. Text BLOBs are edited as multi-line text. Binary BLOBs can be replaced by uploading a file (Load from file…) or downloaded. Changes are saved together with the other grid edits.

Preferences, shortcuts and macros

The ⚙ button in the top bar opens Preferences: - General: theme (auto, light, dark or high contrast), language, NULL display text, date format, confirm before drop. - Editor: font size and minimap. - Keyboard: rebind Execute, Explain, Format and Toggle comment, using CodeMirror key names such as Mod-Enter, F5 or Shift-Alt-f. - Macros: bind SQL to Ctrl/Cmd+1…9. $SELECTION$ is replaced by the selected text. For example, SELECT COUNT(*) FROM $SELECTION$ counts the rows of the selected table name.

AI assistant (opt-in)

The assistant is off by default. To enable it, set FBADMIN_AI_PROVIDER=anthropic and install the extra with pip install 'firebird-admin[ai]'. The Anthropic SDK then picks up your credentials, for example ANTHROPIC_API_KEY. - FBADMIN_AI_MODEL changes the model (default claude-opus-5-5). - FBADMIN_AI_EFFORT changes the effort level (default high).

The Query Tool then gets an ✦ Assistant menu with five tasks: - Explain the plan - Suggest indices - Convert SQL from another dialect - Explain the last error - Ask a free question

Only the SQL text, its plan and the definitions of the tables it uses are sent to the provider. Table data is never sent. Code blocks in the answer have an Insert into editor button.

Other providers can be plugged in. Subclass fbadmin.ai.AIProvider, then register it with fbadmin.ai.register_provider(name, cls) or under the fbadmin.ai_providers entry point group, and select it with FBADMIN_AI_PROVIDER=<name>.