Skip to main content

ARRAY_SIZE

Returns the length of an array, counting NULL elements.

Alias: ARRAY_LENGTH

Syntax

ARRAY_SIZE(<array>)

Return Type

BIGINT

Examples

SELECT ARRAY_SIZE([1, 2, 3]) AS size_plain;

┌──────────┐
│ size_plain │
├──────────┤
3
└──────────┘
SELECT ARRAY_SIZE([1, NULL, 3]) AS size_with_null;

┌──────────────┐
│ size_with_null│
├──────────────┤
3
└──────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today