Query Editor

About the query editor

After connecting to a data source, users can explore database objects and execute commands in the query editor.

  • Object Explorer

    The object browser displays information in a tree format, giving you an instant view of database details like tables, views, indexes, schemas, columns, keys, constraints, triggers, procedures, functions, and more.

    Clicking on an object (for example, a database table) will load its details on the right-hand side of the screen. You can also view important details like sessions, tablespaces, and extensions. The information displayed is specific to your data source.

  • Data Grid

    The data grid displays a scrollable grid of zero or more rows for executed SQL queries and statements that return data. Database records are retrieved as they’re scrolled into view or by explicitly fetching more rows.

    Query execution time is displayed, along with an option to download results.

  • Query Editor

    The query editor provides all the necessary tools to write and execute queries, including syntax highlighting, code formatting, and auto completion.

Commands in the query editor

JackDB implements a number of useful standard commands. Commands are various actions that apply to the text in your editor, usually as a query or statement that interacts with your data source.

  • Execute

    The Execute command executes the current query or statement, i.e., any block of text in the editor that your data source accepts as a query or statement. A query or statement can return one of four types of results when it is executed:

    • Error message

      An error message is returned for invalid queries or statements, along with the underlying exception and the error reported by the driver for the data source.

    • Update message

      An update message is returned for statements that modify data but do not return a result set, e.g., a file upload. The number of rows or objects that were accessed or modified is displayed.

    • Result set

      For queries that should return a result set, results are displayed in a scrollable data grid of zero or more rows. Database records are retrieved as they’re scrolled into view or by explicitly fetching more rows.

    • Execution plan

      An execution plan is returned as a result of the Explain and Explain Analyze commands.

  • Execute & Export

    The Execute & Export command executes the current query, and exports the full result set as comma-separated values. Once the query has completed, you can download the generated CSV file via the provided link.

  • Explain

    The Explain command shows the execution plan for the current query or statement.

    The output of the Explain command is database-specific, but usually shows how the query will be executed and gives an estimate of how long it will take to run.

    The output is formatted into a visual tree or table representation of the execution plan.

  • Explain Analyze

    The Explain Analyze command shows the execution plan, actual run times, and other statistics for the current query or statement. This command causes the query to be executed, and is currently only supported on PostgreSQL data sources.

  • Format

    The Format command formats the current query or statement into well-formatted, consistent SQL.

  • Save Snippet

    The Save Snippet command saves the current query as a snippet to your library.

  • Load Snippet

    The Save Snippet command loads a snippet from your library into the editor.

  • Import

    The Import command imports data from a file into an existing table in the database. Supported delimiter formats include commas, tabs, and pipes.

Editor shortcuts (Windows/Linux)

  • Ctrl-Enter - Execute a query or statement in the editor
  • Ctrl-E - Explain and show an estimated execution plan
  • Ctrl-Shift-E - Analyze and include the actual execution plan
  • Ctrl-Shift-F - Format SQL (experimental)
  • Ctrl-Space - Autocomplete SQL (experimental)
  • Ctrl-S - Save a new snippet
  • Ctrl-L - Load a snippet into the editor
  • Ctrl-A - Select all in the editor
  • Ctrl-Z - Undo the last change in the editor
  • Ctrl-Shift-Z - Redo the change that was previously undone

Editor shortcuts (Mac)

  • Command-Enter - Execute a query or statement in the editor
  • Command-E - Explain and show an estimated execution plan
  • Command-Shift-E - Analyze and include the actual execution plan
  • Command-Shift-F - Format SQL (experimental)
  • Control-Space - Autocomplete SQL (experimental)
  • Command-S - Save a new snippet
  • Command-L - Load a snippet into the editor
  • Command-A - Select all in the editor
  • Command-Z - Undo the last change in the editor
  • Command-Shift-Z - Redo the change that was previously undone

Default keyboard shortcuts (Windows/Linux)

  • Ctrl-D - Remove a line
  • Alt-Delete - Remove to the end of a line
  • Ctrl-A - Select all contents of the editor
  • Ctrl-/ - Toggle comment

Default keyboard shortcuts (Mac)

  • Command-D - Remove a line
  • Control-K - Remove to the end of a line
  • Command-A - Select all contents of the editor
  • Command-/ - Toggle comment