Documentation

Flux

InfluxDB 3

  • InfluxDB 3 Core New
  • InfluxDB 3 Enterprise New
  • InfluxDB Clustered
  • InfluxDB 3 Cloud New
  • InfluxDB Cloud Serverless
  • InfluxDB Cloud Dedicated
  • InfluxDB 3 Explorer New

InfluxDB 2

  • InfluxDB OSS v2
  • InfluxDB Cloud (TSM)
  • Flux

InfluxDB 1

  • InfluxDB 1 OSS
  • InfluxDB 1 Enterprise
  • InfluxDB 1 Cloud

Telegraf

  • Telegraf
  • Telegraf Controller New
  • Telegraf Enterprise New

Other products

  • Chronograf
  • Kapacitor
  • Flux documentation
  • Get started
    • Data model
    • Syntax basics
    • Query basics
  • Work with Flux types
    • Basic types
      • Boolean
      • Bytes
      • Duration
      • Regular expression
      • String
      • Time
      • Float
      • Integer
      • UIntegers
      • Null
    • Composite types
      • Record
      • Array
      • Dictionary
      • Function
    • Dynamic types
  • Query data sources
    • InfluxDB
    • SQL databases
      • Amazon RDS
      • Athena
      • BigQuery
      • CockroachDB
      • MariaDB
      • MySQL
      • Percona
      • PostgreSQL
      • SAP HANA
      • Snowflake
      • SQL Server
      • SQLite
      • Vertica
    • CSV
    • Bigtable
    • Select data by hour
  • Write to data sources
    • InfluxDB
    • SQL databases
      • Amazon RDS
      • BigQuery
      • CockroachDB
      • MariaDB
      • MySQL
      • Percona
      • PostgreSQL
      • SAP HANA
      • Snowflake
      • SQL Server
      • SQLite
      • Vertica
  • Define functions
  • Process data
    • Assign custom states
    • Construct JSON with reduce()
  • Join data
    • Inner join
    • Left outer join
    • Right outer join
    • Full outer join
    • Join on time
    • Troubleshoot joins
  • Work with Prometheus
    • Scrape Prometheus metrics
    • Prometheus metric types
      • Counter
      • Gauge
      • Histogram
      • Summary
  • Reference

  • Release notes
  • Standard library
    • View all functions
    • universe (built-in)
      • aggregateWindow
      • bool
      • bottom
      • bytes
      • chandeMomentumOscillator
      • columns
      • contains
      • count
      • cov
      • covariance
      • cumulativeSum
      • derivative
      • die
      • difference
      • display
      • distinct
      • doubleEMA
      • drop
      • duplicate
      • duration
      • elapsed
      • exponentialMovingAverage
      • fill
      • filter
      • findColumn
      • findRecord
      • first
      • float
      • getColumn
      • getRecord
      • group
      • highestAverage
      • highestCurrent
      • highestMax
      • histogram
      • histogramQuantile
      • holtWinters
      • hourSelection
      • increase
      • int
      • integral
      • join
      • kaufmansAMA
      • kaufmansER
      • keep
      • keys
      • keyValues
      • last
      • length
      • limit
      • linearBins
      • logarithmicBins
      • lowestAverage
      • lowestCurrent
      • lowestMin
      • map
      • max
      • mean
      • median
      • min
      • mode
      • movingAverage
      • now
      • pearsonr
      • pivot
      • quantile
      • range
      • reduce
      • relativeStrengthIndex
      • rename
      • sample
      • set
      • skew
      • sort
      • spread
      • stateCount
      • stateDuration
      • stateTracking
      • stddev
      • string
      • sum
      • tableFind
      • tail
      • time
      • timedMovingAverage
      • timeShift
      • timeWeightedAvg
      • toBool
      • today
      • toFloat
      • toInt
      • top
      • toString
      • toTime
      • toUInt
      • tripleEMA
      • tripleExponentialDerivative
      • truncateTimeColumn
      • uint
      • union
      • unique
      • window
      • yield
    • array
      • array.concat
      • array.filter
      • array.from
      • array.map
    • bitwise
      • bitwise.sand
      • bitwise.sclear
      • bitwise.slshift
      • bitwise.snot
      • bitwise.sor
      • bitwise.srshift
      • bitwise.sxor
      • bitwise.uand
      • bitwise.uclear
      • bitwise.ulshift
      • bitwise.unot
      • bitwise.uor
      • bitwise.urshift
      • bitwise.uxor
    • contrib
      • anaisdg
        • anomalydetection
          • anomalydetection.mad
        • statsmodels
          • statsmodels.linearRegression
      • bonitoo-io
        • alerta
          • alerta.alert
          • alerta.endpoint
        • hex
          • hex.bytes
          • hex.int
          • hex.string
          • hex.uint
        • servicenow
          • servicenow.endpoint
          • servicenow.event
        • tickscript
          • tickscript.alert
          • tickscript.compute
          • tickscript.deadman
          • tickscript.defineCheck
          • tickscript.groupBy
          • tickscript.join
          • tickscript.select
          • tickscript.selectWindow
        • victorops
          • victorops.alert
          • victorops.endpoint
        • zenoss
          • zenoss.endpoint
          • zenoss.event
      • chobbs
        • discord
          • discord.endpoint
          • discord.send
      • jsternberg
        • influxdb
          • from
          • influxdb.select
      • qxip
        • clickhouse
          • clickhouse.query
        • hash
          • hash.b64
          • hash.cityhash64
          • hash.hmac
          • hash.md5
          • hash.sha1
          • hash.sha256
          • hash.xxhash64
        • logql
          • logql.query_range
      • rhajek
        • bigpanda
          • bigpanda.endpoint
          • bigpanda.sendAlert
          • bigpanda.statusFromLevel
      • RohanSreerama5
        • naiveBayesClassifier
          • naiveBayesClassifier.naiveBayes
      • sranka
        • opsgenie
          • opsgenie.endpoint
          • opsgenie.respondersToJSON
          • opsgenie.sendAlert
        • sensu
          • sensu.endpoint
          • sensu.event
          • sensu.toSensuName
        • teams
          • teams.endpoint
          • teams.message
        • telegram
          • telegram.endpoint
          • telegram.message
        • webexteams
          • webexteams.endpoint
          • webexteams.message
      • tomhollingworth
        • events
          • events.duration
    • csv
      • csv.from
    • date
      • boundaries
        • boundaries.friday
        • boundaries.monday
        • boundaries.month
        • boundaries.saturday
        • boundaries.sunday
        • boundaries.thursday
        • boundaries.tuesday
        • boundaries.wednesday
        • boundaries.week
        • boundaries.yesterday
      • date.add
      • date.hour
      • date.microsecond
      • date.millisecond
      • date.minute
      • date.month
      • date.monthDay
      • date.nanosecond
      • date.quarter
      • date.scale
      • date.second
      • date.sub
      • date.time
      • date.truncate
      • date.week
      • date.weekDay
      • date.year
      • date.yearDay
    • dict
      • dict.fromList
      • dict.get
      • dict.insert
      • dict.remove
    • experimental
      • aggregate
        • aggregate.rate
      • array
        • array.concat
        • array.filter
        • array.from
        • array.map
        • array.toBool
        • array.toDuration
        • array.toFloat
        • array.toInt
        • array.toString
        • array.toTime
        • array.toUInt
      • bigtable
        • bigtable.from
      • bitwise
        • bitwise.sand
        • bitwise.sclear
        • bitwise.slshift
        • bitwise.snot
        • bitwise.sor
        • bitwise.srshift
        • bitwise.sxor
        • bitwise.uand
        • bitwise.uclear
        • bitwise.ulshift
        • bitwise.unot
        • bitwise.uor
        • bitwise.urshift
        • bitwise.uxor
      • csv
        • csv.from
      • date
        • boundaries
          • boundaries.friday
          • boundaries.monday
          • boundaries.month
          • boundaries.saturday
          • boundaries.sunday
          • boundaries.thursday
          • boundaries.tuesday
          • boundaries.wednesday
          • boundaries.week
          • boundaries.yesterday
      • dynamic
        • dynamic.asArray
        • dynamic.dynamic
        • dynamic.isType
        • dynamic.jsonEncode
        • dynamic.jsonParse
      • geo
        • geo.asTracks
        • geo.filterRows
        • geo.getGrid
        • geo.getLevel
        • geo.gridFilter
        • geo.groupByArea
        • geo.s2CellIDToken
        • geo.s2CellLatLon
        • geo.shapeData
        • geo.ST_Contains
        • geo.ST_Distance
        • geo.ST_DWithin
        • geo.ST_Intersects
        • geo.ST_Length
        • geo.ST_LineString
        • geo.stContains
        • geo.stDistance
        • geo.stLength
        • geo.strictFilter
        • geo.toRows
        • geo.totalDistance
      • http
        • requests
          • requests.do
          • requests.get
          • requests.peek
          • requests.post
        • http.get
      • influxdb
        • influxdb.api
      • iox
        • iox.from
        • iox.sql
        • iox.sqlInterval
      • json
        • json.parse
      • mqtt
        • mqtt.publish
        • mqtt.to
      • oee
        • oee.APQ
        • oee.computeAPQ
      • polyline
        • polyline.rdp
      • prometheus
        • prometheus.histogramQuantile
        • prometheus.scrape
      • query
        • query.filterFields
        • query.filterMeasurement
        • query.fromRange
        • query.inBucket
      • record
        • record.get
      • table
        • table.fill
      • usage
        • usage.from
        • usage.limits
      • experimental.addDuration
      • experimental.alignTime
      • experimental.catch
      • experimental.chain
      • experimental.count
      • experimental.diff
      • experimental.distinct
      • experimental.fill
      • experimental.first
      • experimental.group
      • experimental.histogram
      • experimental.histogramQuantile
      • experimental.integral
      • experimental.join
      • experimental.kaufmansAMA
      • experimental.last
      • experimental.max
      • experimental.mean
      • experimental.min
      • experimental.mode
      • experimental.objectKeys
      • experimental.preview
      • experimental.quantile
      • experimental.set
      • experimental.skew
      • experimental.spread
      • experimental.stddev
      • experimental.subDuration
      • experimental.sum
      • experimental.to
      • experimental.unique
      • experimental.unpivot
      • experimental.window
    • generate
      • generate.from
    • http
      • requests
        • requests.do
        • requests.get
        • requests.peek
        • requests.post
      • http.basicAuth
      • http.endpoint
      • http.pathEscape
      • http.post
    • influxdata
      • influxdb
        • monitor
          • monitor.check
          • monitor.deadman
          • monitor.from
          • monitor.log
          • monitor.logs
          • monitor.notify
          • monitor.stateChanges
          • monitor.stateChangesOnly
          • monitor.write
        • sample
          • sample.alignToNow
          • sample.data
          • sample.list
        • schema
          • schema.fieldKeys
          • schema.fieldsAsCols
          • schema.measurementFieldKeys
          • schema.measurements
          • schema.measurementTagKeys
          • schema.measurementTagValues
          • schema.tagKeys
          • schema.tagValues
        • secrets
          • secrets.get
        • tasks
          • tasks.lastSuccess
        • v1
          • v1.databases
          • v1.fieldKeys
          • v1.fieldsAsCols
          • v1.json
          • v1.measurementFieldKeys
          • v1.measurements
          • v1.measurementTagKeys
          • v1.measurementTagValues
          • v1.tagKeys
          • v1.tagValues
        • buckets
        • from
        • influxdb.cardinality
        • influxdb.wideTo
        • to
    • internal
      • boolean
      • debug
        • debug.feature
        • debug.getOption
        • debug.null
        • debug.opaque
        • debug.pass
        • debug.sink
        • debug.slurp
      • gen
        • gen.tables
      • influxql
      • location
      • promql
        • promql.changes
        • promql.emptyTable
        • promql.extrapolatedRate
        • promql.holtWinters
        • promql.instantRate
        • promql.join
        • promql.labelReplace
        • promql.linearRegression
        • promql.promHistogramQuantile
        • promql.promqlDayOfMonth
        • promql.promqlDayOfWeek
        • promql.promqlDaysInMonth
        • promql.promqlHour
        • promql.promqlMinute
        • promql.promqlMonth
        • promql.promqlYear
        • promql.quantile
        • promql.resets
        • promql.timestamp
      • testing
        • testing.assertMatches
        • testing.shouldErrorWithCode
      • testutil
        • testutil.fail
        • testutil.makeAny
        • testutil.makeRecord
        • testutil.yield
    • interpolate
      • interpolate.linear
    • join
      • join.full
      • join.inner
      • join.left
      • join.right
      • join.tables
      • join.time
    • json
      • json.encode
    • kafka
      • kafka.to
    • math
      • math.abs
      • math.acos
      • math.acosh
      • math.asin
      • math.asinh
      • math.atan
      • math.atan2
      • math.atanh
      • math.cbrt
      • math.ceil
      • math.copysign
      • math.cos
      • math.cosh
      • math.dim
      • math.erf
      • math.erfc
      • math.erfcinv
      • math.erfinv
      • math.exp
      • math.exp2
      • math.expm1
      • math.float64bits
      • math.float64frombits
      • math.floor
      • math.frexp
      • math.gamma
      • math.hypot
      • math.ilogb
      • math.isInf
      • math.isNaN
      • math.j0
      • math.j1
      • math.jn
      • math.ldexp
      • math.lgamma
      • math.log
      • math.log10
      • math.log1p
      • math.log2
      • math.logb
      • math.mInf
      • math.mMax
      • math.mMin
      • math.mod
      • math.modf
      • math.NaN
      • math.nextafter
      • math.pow
      • math.pow10
      • math.remainder
      • math.round
      • math.roundtoeven
      • math.signbit
      • math.sin
      • math.sincos
      • math.sinh
      • math.sqrt
      • math.tan
      • math.tanh
      • math.trunc
      • math.y0
      • math.y1
      • math.yn
    • pagerduty
      • pagerduty.actionFromLevel
      • pagerduty.actionFromSeverity
      • pagerduty.dedupKey
      • pagerduty.endpoint
      • pagerduty.sendEvent
      • pagerduty.severityFromLevel
    • planner
    • profiler
    • pushbullet
      • pushbullet.endpoint
      • pushbullet.pushData
      • pushbullet.pushNote
    • regexp
      • regexp.compile
      • regexp.findString
      • regexp.findStringIndex
      • regexp.getString
      • regexp.matchRegexpString
      • regexp.quoteMeta
      • regexp.replaceAllString
      • regexp.splitRegexp
    • runtime
      • runtime.version
    • sampledata
      • sampledata.bool
      • sampledata.float
      • sampledata.int
      • sampledata.numericBool
      • sampledata.string
      • sampledata.uint
    • slack
      • slack.endpoint
      • slack.message
      • slack.validateColorString
    • socket
      • socket.from
    • sql
      • sql.from
      • sql.to
    • strings
      • strings.compare
      • strings.containsAny
      • strings.containsStr
      • strings.countStr
      • strings.equalFold
      • strings.hasPrefix
      • strings.hasSuffix
      • strings.index
      • strings.indexAny
      • strings.isDigit
      • strings.isLetter
      • strings.isLower
      • strings.isUpper
      • strings.joinStr
      • strings.lastIndex
      • strings.lastIndexAny
      • strings.repeat
      • strings.replace
      • strings.replaceAll
      • strings.split
      • strings.splitAfter
      • strings.splitAfterN
      • strings.splitN
      • strings.strlen
      • strings.substring
      • strings.title
      • strings.toLower
      • strings.toTitle
      • strings.toUpper
      • strings.trim
      • strings.trimLeft
      • strings.trimPrefix
      • strings.trimRight
      • strings.trimSpace
      • strings.trimSuffix
    • system
      • system.time
    • testing
      • expect
        • expect.planner
      • testing.assertEmpty
      • testing.assertEquals
      • testing.assertEqualValues
      • testing.diff
      • testing.load
      • testing.shouldError
    • timezone
      • timezone.fixed
      • timezone.location
    • types
      • types.isNumeric
      • types.isType
  • Flux specification
    • Notation
    • Representation
    • Lexical elements
    • Variables
    • Options
    • Types
    • Blocks
    • Assignment and scope
    • Expressions
    • Operators
    • Packages
    • Attributes
    • Statements
    • Side effects
    • System built-ins
    • Data model
  • Function types & categories
  • Type signatures
  • Flux versions in InfluxDB
  • Future of Flux
  • Documentation MCP server

Related to "Sql"

iox.sqlInterval() function

iox.sqlInterval() converts a duration value to a SQL interval string.

© 2026 InfluxData, Inc.

Where are you running InfluxDB?

Select your InfluxDB Cloud region and cluster or your InfluxDB OSS URL and we’ll customize code examples for you. Identify your InfluxDB Cloud cluster.

  • InfluxDB Cloud
  • InfluxDB OSS or Enterprise
AWS
  • US West (Oregon)

GCP
Azure
Default
Custom

For more information, see InfluxDB Cloud regions or InfluxDB OSS URLs.

Thank you for your feedback!

Let us know what we can do better:

Thank you!

No thanks

InfluxDB OSS 2.10.1 is available

When upgrading from 2.8.x or earlier, save any API tokens you need. Token hashing is enabled by default since 2.9.0; migrated token strings can’t be recovered.
  • Improved /health and /ready startup diagnostics.

Release notes | Token hashing

Explorer 1.11 is now available

Six new visualization types, plus password and SSO sign-in and user management for InfluxDB 3 Enterprise.
  • Password and SSO sign-in with role-based access.
  • Manage Users page under a new Security section.
  • New visualizations: Area, Single Stat, Gauge, Pie, Scatter, and Ranking.
  • EXPLAIN and EXPLAIN ANALYZE in the SQL editor.

Explorer 1.11 release notes

InfluxDB 3.12 is now available

Back up your catalog before you upgrade. Rolling back to 3.11.x requires restoring that backup.
  • Add columns to existing tables with influxdb3 update table.
  • Faster queries and startup with DataFusion 52.5.
  • New defaults: finite --max-concurrent-queries and an enforced WAL buffer limit.

Upgrade guide | Release notes | Announcement

InfluxDB 3 Enterprise 3.12 is now available

Back up your catalog before you upgrade. Rolling back to 3.11.x requires restoring that backup.
  • Faster bulk import, including from object storage.
  • Distributed compaction (beta).
  • Schema enforcement per database.
  • User authentication and RBAC are generally available.

Upgrade guide | Release notes | Announcement

Telegraf Enterprise & Controller 1.2 now available

Security advisory scanning (Telegraf Enterprise), agent-level metrics and logs, fleet health summaries, automated deployment tokens, and an official Docker image.
  • Security advisories (Telegraf Enterprise): see which agents run an affected Telegraf version.
  • Agent heartbeat data: errors, warnings, and logs on the agent detail page.
  • Fleet summary and heartbeat service health at a glance.
  • Bootstrap and pre-shared API tokens for automated deployments.

Run Telegraf Controller in Docker
Release notes
Read the announcement

InfluxDB OSS 1.13.2 is now available

InfluxDB OSS 1.13.2 includes a bug fix and a Go version update.

View InfluxDB OSS 1.13.2 release notes

Key updates in InfluxDB OSS 1.13.2:

  • Resolve an unimplemented interface member.
  • Update Go to version 1.26.10.

For details, see the InfluxDB OSS 1.13.2 release notes.

InfluxDB Enterprise 1.13.1 is now available

InfluxDB Enterprise 1.13.1 adds mTLS support and includes the InfluxDB OSS 1.13.1 updates.

View InfluxDB Enterprise 1.13.1 release notes

Key updates in InfluxDB Enterprise 1.13.1:

  • mTLS support for Enterprise data and meta nodes.
  • All InfluxDB OSS 1.13.1 updates apply to Enterprise too.

For details, see the InfluxDB Enterprise 1.13.1 release notes.

InfluxDB 3 Cloud trials are now available

Try fully managed InfluxDB 3. Sign up for a trial.

InfluxDB 3 Cloud brings InfluxDB 3 to a fully managed, single-tenant service. InfluxData runs the cluster; you write, query, and administer your data.

Highlights:

  • Fully managed and single-tenant
  • SQL and InfluxQL support
  • Native v3 write and query APIs

For more information, see the InfluxDB 3 Cloud documentation.