Write and Run Queries
- reference
To query data in Operational Insights collections you use SQL++, a SQL-for-JSON language specification that is similar to SQL.
To support the full feature set of Operational Insights, SQL++ for Operational Insights, a customized and extended version of the SQL++ for Operational Insights query language, is available. See About SQL++.
Operational Insights uses rule-based optimization to query your collections until you run an ANALYZE COLLECTION statement on each collection involved in a query.
As the data in a collection changes, you can run ANALYZE COLLECTION periodically to update the information used for CBO.
See Cost-Based Optimizer.
Prerequisites
To use the Operational Insights UI, you need the Operational Insights Access role along with specific privileges.
Using the Query Editor
The query editor is where you build and run queries. You can use the query editor’s Query Context lists to set the database and scope you want a query to use.
You use SQL++ for Operational Insights to write queries. For information about the SQL++ statements and syntax you use in Operational Insights, see DDL Statements and DML Statements.
Since large result sets can take a long time to display, it’s recommended that you use the LIMIT clause as part of your query when appropriate.
|
The query editor provides syntax highlighting. For easy viewing, SQL++ for Operational Insights keywords, numbers, and string literals are differently colored.
You can use the query options to define request-level parameters, change the query timeout period, and so on. See Set Query Options.
After entering a query, you can run the query to view the results. You can also view metrics and the query plan.
Run a Query
After you enter a query, click Execute.
You can also execute a query by typing a semicolon ; at the end of the query and then using the Enter key.
|
While the query is running, the Execute button changes to Cancel, which allows you to cancel the running query. You can also cancel DDL and DML statements. When you cancel a running query or statement, it stops the activity on the data source side as well.
When a query runs to completion, its results appear in the query results pane of the query editor.