Skip to content
Cloudflare Docs

Changelog

New updates and improvements at Cloudflare.

Subscribe to RSS
View all RSS feeds

hero image

More SQL aggregate, date and time functions available in Workers Analytics Engine

You can now perform more powerful queries directly in Workers Analytics Engine with a major expansion of our SQL function library.

Workers Analytics Engine allows you to ingest and store high-cardinality data at scale (such as custom analytics) and query your data through a simple SQL API.

Today, we've expanded Workers Analytics Engine's SQL capabilities with several new functions:

New aggregate functions:

  • countIf() - count the number of rows which satisfy a provided condition
  • sumIf() - calculate a sum from rows which satisfy a provided condition
  • avgIf() - calculate an average from rows which satisfy a provided condition

New date and time functions:

  • toYear()
  • toMonth()
  • toDayOfMonth()
  • toDayOfWeek()
  • toHour()
  • toMinute()
  • toSecond()
  • toStartOfYear()
  • toStartOfMonth()
  • toStartOfWeek()
  • toStartOfDay()
  • toStartOfHour()
  • toStartOfFifteenMinutes()
  • toStartOfTenMinutes()
  • toStartOfFiveMinutes()
  • toStartOfMinute()
  • today()
  • toYYYYMM()

Ready to get started?

Whether you're building usage-based billing systems, customer analytics dashboards, or other custom analytics, these functions let you get the most out of your data. Get started with Workers Analytics Engine and explore all available functions in our SQL reference documentation.