Query Data in EMQX Tables
EMQX Tables provides a unified and interactive way to query and analyze your data in EMQX Cloud. All querying is performed through the Data Explorer, which serves as the primary interface for writing, executing, and analyzing queries.
To get started with the query interface and learn how to use its features effectively, see Data Explorer.
Query Overview
EMQX Tables provides powerful and flexible ways to query your data. You can use either SQL or Prometheus Query Language (PromQL), depending on your query style and use case.
Both SQL and PromQL operate on the same underlying data model, returning consistent results. The difference lies in query syntax and analytical approach rather than in the data being queried.
SQL Queries
SQL is the most flexible way to query EMQX Tables.
Use SQL when you need to:
- Perform ad-hoc data exploration
- Filter, sort, and aggregate data
- Query specific columns or time ranges explicitly
- Work with structured or semi-structured IoT data
SQL queries in EMQX Tables are extended to work naturally with time-series data, making them suitable for both traditional analytics and time-based analysis.
Refer to Use SQL to Query Data for syntax, examples, and best practices.
PromQL Queries
PromQL is designed specifically for time-series analysis.
Use PromQL when you want to:
- Calculate rates, increases, and deltas over time
- Perform rolling or window-based aggregations
- Apply Prometheus-style metric analysis
- Reuse existing PromQL knowledge and dashboards
EMQX Tables supports PromQL natively, including multi-field tables and additional extensions such as field selection and cross-database queries.
Refer to Use PromQL to Query Data for supported features, examples, and limitations.