Documentation

Query data with InfluxQL

Use InfluxQL (an SQL-like query language) to interact with InfluxDB, and query and analyze your times series data.

In InfluxDB 1.x, data is stored in databases and retention policies. In InfluxDB OSS Cloud, data is stored in buckets. Because InfluxQL uses the 1.x data model, a bucket must be mapped to a database and retention policy (DBRP) before it can be queried using InfluxQL.

To query data with InfluxQL, complete the following steps:

  1. Verify buckets have a mapping.
  2. Create DBRP mappings for unmapped buckets.
  3. Query a mapped bucket with InfluxQL.

InfluxQL reference documentation

For complete InfluxQL reference documentation, see the InfluxQL specification for InfluxDB 2.x.

Verify buckets have a mapping

  1. To verify the buckets you want to query are mapped to a database and retention policy, use the influx CLI or the InfluxDB API. For examples, see List DBRP mappings.

  2. If you do not find a DBRP mapping for a bucket, create a new DBRP mapping to map the unmapped bucket.

Create DBRP mappings for unmapped buckets

Query a mapped bucket with InfluxQL

The influx CLI provides an InfluxQL shell where you can execute InfluxQL queries in an interactive Read-Eval-Print-Loop (REPL).

  1. If you haven’t already, do the following:

  2. Use the following command to start an InfluxQL shell:

    influx v1 shell
  3. Execute an InfluxQL query inside the InfluxQL shell.

    SELECT used_percent FROM "example-db"."example-rp"."example-measurement" WHERE host=host1

    For more information, see how to use the InfluxQL shell. For more information about DBRP mappings, see Manage DBRP mappings.

The InfluxDB 1.x compatibility API supports all InfluxDB 1.x client libraries and integrations in InfluxDB Cloud.

  1. To query a mapped bucket with InfluxQL, use the /query 1.x compatibility endpoint, and include the following in your request:

    • Request method: GET
    • Headers:
    • Query parameters:
      • db: 1.x database to query

      • rp: 1.x retention policy to query (if no retention policy is specified, InfluxDB uses the default retention policy for the specified database)

      • q: URL-encoded InfluxQL query

        URL-encode query parameters that may contain whitespace or other special characters.

    curl --get http://localhost:8086/query?db=example-db \
      --header "Authorization: Token YourAuthToken" \
      --data-urlencode "q=SELECT used_percent FROM \"example-db\".\"example-rp\".\"example-measurement\" WHERE host=host1"

    By default, the /query compatibility endpoint returns results in JSON.

  2. (Optional) To return results as CSV, include the Accept: application/csv header.

For more information about DBRP mappings, see Manage DBRP mappings.

InfluxQL support

InfluxDB OSS 2.x supports the following InfluxQL statements and clauses. See supported and unsupported queries below.

Supported InfluxQL queries
  • DELETE*
  • DROP MEASUREMENT*
  • EXPLAIN ANALYZE
  • SELECT (read-only)
  • SHOW DATABASES
  • SHOW SERIES
  • SHOW MEASUREMENTS
  • SHOW TAG KEYS
  • SHOW FIELD KEYS
  • SHOW SERIES EXACT CARDINALITY
  • SHOW TAG KEY CARDINALITY
  • SHOW FIELD KEY CARDINALITY

* These commands delete data.

Unsupported InfluxQL queries
  • SELECT INTO
  • ALTER
  • CREATE
  • DROP (limited support)
  • GRANT
  • KILL
  • REVOKE
  • SHOW SERIES CARDINALITY

Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.5

Key enhancements in InfluxDB 3.5 and the InfluxDB 3 Explorer 1.3.

See the Blog Post

InfluxDB 3.5 is now available for both Core and Enterprise, introducing custom plugin repository support, enhanced operational visibility with queryable CLI parameters and manual node management, stronger security controls, and general performance improvements.

InfluxDB 3 Explorer 1.3 brings powerful new capabilities including Dashboards (beta) for saving and organizing your favorite queries, and cache querying for instant access to Last Value and Distinct Value cachesβ€”making Explorer a more comprehensive workspace for time series monitoring and analysis.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On November 3, 2025, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2

InfluxDB Cloud powered by TSM