You can write a query in DDSQL Editor in natural language or in SQL. See the DDSQL reference for supported SQL expressions and usage details. Example queries are also provided throughout the UI.
To run a natural language query, type your question into the search bar, or click on one of the provided examples below the search bar.
To run a SQL query, type a valid DDSQL expression into the top section of the page, or run one of the examples listed under Queries to get you started.
Example querying flow
This example flow highlights the key features of DDSQL Editor. If the example query isn’t suitable for your data, you can use your own query instead.
If you aren’t sure which fields contain the data you want, you can use the schema explorer to examine the available tables, their columns, and their relationships to other tables:
Click the database icon in the left sidebar to open the schema explorer.
The current query is for the host table, so click All Tables > Hosts > host to view the available fields. Decide which field to add to the query. This example uses availability_zone.
Edit the query SQL to add the availability_zone to the result:
Tags can be queried as if they are table columns. Add a WHERE clause to the query to only count instances in production:
SELECTinstance_type,availability_zone,COUNT(*)AScountFROMhostWHERE#env='prod'-- Use '#' in front of tag names
GROUPBYinstance_type,availability_zoneORDERBYcountDESC;
Double-click the title of the query to edit the title, changing it to “Production instance types by availability zone”.
Click Save Query.
Click the page icon in the left sidebar to open the Saved Queries panel and find your saved query in the list.
6. View the query in recent queries
If you forget to save a useful query before navigating away from it, you can still access it in the Recent Queries pane. Click the clock icon in the left sidebar to view a list of recent queries.