Skip to content

Conversation

@jstirnaman
Copy link
Contributor

Summary

  • Add practical LAG window function examples to the SQL reference showing time-based value comparisons
  • Create new "Compare values" query guide covering common patterns:
    • Differences between current and previous values
    • Percentage changes over time
    • Comparisons at exact time intervals (e.g., 1 hour ago)
  • Add counter metrics examples for monotonically increasing data

Test plan

  • Verify examples render correctly on all InfluxDB 3 product pages
  • Confirm SQL queries are syntactically valid
  • Check cross-links between reference and guide work

Refs: Kapa.ai conversation https://app.kapa.ai/720100f9-ce93-4305-88fd-5fcf71effad7/conversations/4536b79e-3930-4359-87f5-2ad9ccc1917d

Enhance window function documentation with practical examples for
calculating differences between current and previous values (e.g., 1h ago).

- Add 3 LAG examples to window functions reference with tested queries
- Create new 'Compare values' query guide covering common time-based
  comparison patterns (differences, percentage changes, exact intervals)
- Add guide frontmatter for all InfluxDB 3 products

All queries validated against InfluxDB 3 Core.

Refs: Kapa.ai conversation https://app.kapa.ai/720100f9-ce93-4305-88fd-5fcf71effad7/conversations/4536b79e-3930-4359-87f5-2ad9ccc1917d
Starting from: https://docs.influxdata.com/influxdb3/cloud-serverless/reference/sql/functions/window/
Enhance time-based value comparisons with counter metrics patterns
using LAG and GREATEST to handle counter resets.

- Add counter metrics section with 3 examples (rate, cumulative, intervals)
- Include tested queries for non-negative differences and aggregation
- Document workarounds for Flux increase() and InfluxQL NON_NEGATIVE_DIFFERENCE()

All queries validated against InfluxDB 3 Core.

Refs: Kapa.ai conversation https://app.kapa.ai/720100f9-ce93-4305-88fd-5fcf71effad7/conversations/16b13679-0ced-4780-ab58-3d9cacb2d899
Starting from: https://docs.influxdata.com/influxdb3/enterprise/
@jstirnaman jstirnaman requested a review from sanderson November 30, 2025 18:13
Copy link
Collaborator

@sanderson sanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌🏻 These examples are great! Only one suggestion.

@jstirnaman jstirnaman merged commit ec70614 into master Dec 1, 2025
2 checks passed
@jstirnaman jstirnaman deleted the jts-sql-time-diff branch December 1, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants