Introduction to Query Console
- Last Updated: April 14, 2026
- 4 minute read
- MarkLogic Server
- Version 11.0
- Documentation
Query Console is an interactive web-based query development tool for writing and executing ad-hoc queries in XQuery, Server-Side JavaScript, SQL and SPARQL. Query Console enables you to quickly test code snippets, debug problems, profile queries, and run administrative XQuery scripts.
The following terms and definitions cover the primary Query Console components:
This section includes descriptions of the following:
Using Query Console, you can:
- Create queries in JavaScript, XQuery, SQL, and SPARQL.
- Create, modify, rename, and delete queries.
- Run a query and view the output in multiple formats.
- Profile query performance (XQuery and JavaScript only).
- Explore and edit the contents of a database.
- Create, delete, copy, rename, and reorganize workspaces to improve query organization.
- Restore a query to a previous version from the saved history.
- Export and import workspaces for easy sharing among users or across MarkLogic Server instances.
The query editor in Query Console includes features such as
- Syntax coloring
- Typeahead suggestions
- Pop-up function reference documentation
- Automatic closing and highlighting of quotes, parentheses, braces, and other grouping characters
The database explorer enables you to browse and edit the contents of a database. You can view document content and metadata, and insert, update, and delete content without writing any code.
The workspaces and queries created in Query Console are stored in MarkLogic Server, so they are available to you from any computer with access to your MarkLogic Server instance. For example, you can create workspaces and queries on your desktop computer and use them from a lab machine with access to the same MarkLogic Server instance.
You should only have one Query Console session active at a time for any given MarkLogic user. Query Console saves state to MarkLogic Server. If a user has multiple Query Console sessions active concurrently, the state can become inconsistent.
The picture below summarizes key Query Console UI features.

Query Console Editor
Click on Editor Options in the menu bar to open the Editor Options dialog box for additional Query Console options.

The editor options enable you to configure the auto-close functions for parenthesis using auto complete. You can also control indenting, matching brackets, and closing brackets. The table lists the options available.
Processing Query Window
A Processing Query window is shown while Query Console is processing a query. It displays the progress of the query, along with additional information about the query.

Query Console Request Cancellation
If you set the Request Cancellation options in the Editor Options, the query will be cancelled if any of the conditions are met. For example, you can set the elapsed time to 3 seconds in the Editor Options.

Click Submit. In the Query Console, set the Query Type to JavaScript. Run two queries, xdmp.sleep(5000) and xdmp.sleep(2000). Click the Run button.

The query will be cancelled because the time limit was exceeded. Query Console can automatically cancel any query execution based on the thresholds you configure.
Query Plan Viewer
You can use the Query Console to view the query plan for a SQL or SPARQL query. Two types of query plan are available: the estimated plan and the actual plan. Tooltips provide information about the elements of query plan. See Viewing Query Plans for more details.
For more information on using specific Query Console features, see the Query Console Walkthrough.