|
| 1 | +--- |
| 2 | +title: Workers Analytics Engine adds supports for new SQL functions |
| 3 | +description: Workers Analytics Engine now supports additional SQL functions including new mathematical operations, aggregate functions, and bit functions! |
| 4 | +date: 2025-10-02 |
| 5 | +products: |
| 6 | + - workers-analytics-engine |
| 7 | +--- |
| 8 | +You can now perform more powerful queries directly in [Workers Analytics Engine](https://developers.cloudflare.com/analytics/analytics-engine/) with a major expansion of our SQL function library. |
| 9 | + |
| 10 | +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. |
| 11 | + |
| 12 | +Today, we've expanded Workers Analytics Engine's SQL capabilities with several new functions: |
| 13 | + |
| 14 | +[**New aggregate functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/aggregate-functions/) |
| 15 | +- `argMin()` - Returns the value associated with the minimum in a group |
| 16 | +- `argMax()` - Returns the value associated with the maximum in a group |
| 17 | +- `topK()` - Returns an array of the most frequent values in a group |
| 18 | +- `topKWeighted()` - Returns an array of the most frequent values in a group using weights |
| 19 | +- `first_value()` - Returns the first value in an ordered set of values within a partition |
| 20 | +- `last_value()` - Returns the last value in an ordered set of values within a partition |
| 21 | + |
| 22 | +[**New bit functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/bit-functions/) |
| 23 | +- `bitAnd()` - Returns the bitwise AND of two expressions |
| 24 | +- `bitCount()` - Returns the number of bits set to one in the binary representation of a number |
| 25 | +- `bitHammingDistance()` - Returns the number of bits that differ between two numbers |
| 26 | +- `bitNot()` - Returns a number with all bits flipped |
| 27 | +- `bitOr()` - Returns the inclusive bitwise OR of two expressions |
| 28 | +- `bitRotateLeft()` - Rotates all bits in a number left by specified positions |
| 29 | +- `bitRotateRight()` - Rotates all bits in a number right by specified positions |
| 30 | +- `bitShiftLeft()` - Shifts all bits in a number left by specified positions |
| 31 | +- `bitShiftRight()` - Shifts all bits in a number right by specified positions |
| 32 | +- `bitTest()` - Returns the value of a specific bit in a number |
| 33 | +- `bitXor()` - Returns the bitwise exclusive-or of two expressions |
| 34 | + |
| 35 | +[**New mathematical functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/mathematical-functions/) |
| 36 | +- `abs()` - Returns the absolute value of a number |
| 37 | +- `log()` - Computes the natural logarithm of a number |
| 38 | +- `round()` - Rounds a number to a specified number of decimal places |
| 39 | +- `ceil()` - Rounds a number up to the nearest integer |
| 40 | +- `floor()` - Rounds a number down to the nearest integer |
| 41 | +- `pow()` - Returns a number raised to the power of another number |
| 42 | + |
| 43 | +[**New string functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/string-functions/) |
| 44 | +- `lowerUTF8()` - Converts a string to lowercase using UTF-8 encoding |
| 45 | +- `upperUTF8()` - Converts a string to uppercase using UTF-8 encoding |
| 46 | + |
| 47 | +[**New encoding functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/encoding-functions/) |
| 48 | +- `hex()` - Converts a number to its hexadecimal representation |
| 49 | +- `bin()` - Converts a string to its binary representation |
| 50 | + |
| 51 | +[**New type conversion functions:**](https://developers.cloudflare.com/analytics/analytics-engine/sql-reference/type-conversion-functions/) |
| 52 | +- `toUInt8()` - Converts any numeric expression, or expression resulting in a string representation of a decimal, into an unsigned 8 bit integer |
| 53 | + |
| 54 | + |
| 55 | +## Ready to get started? |
| 56 | +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 ](/analytics/analytics-engine/get-started/) with Workers Analytics Engine and explore all available functions in our [SQL reference documentation](/analytics/analytics-engine/sql-reference/). |
0 commit comments