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:
The query editor in Query Console includes features such as
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.
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.
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.
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.
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.