Skip to main content
Returns the length of the given array, i.e., how many elements it contains. Produces NULL for NULL arrays. Alias: LENGTH (when used with an array argument)

Syntax

ARRAY_LENGTH(<array>)

Parameters

ParameterDescriptionSupported input types
<array>The array whose length should be calculatedARRAY

Return Type

INTEGER

Examples

SELECT ARRAY_LENGTH([1, 2, 3, 4]) AS levels;
levels int
4

Rows: 1Execution time: 5.52ms

SELECT ARRAY_LENGTH([[1, 2, 3], [4, 5, 6, 7]]) AS levels;
levels int
2

Rows: 1Execution time: 5.79ms