> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ARRAY_SIZE

> Counts the elements in an array.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for a NULL collection.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
array_size(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | ARRAY\<T> | Yes | The collection to measure. T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT. Nested elements/fields must satisfy the same element-type restrictions. |

## Returns

* Type: unsigned 64-bit integer; query tools may report INTEGER
* Possible values: A nonnegative count; zero for an empty collection.
* NULL behavior: Returns NULL for a NULL collection.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* NULL elements count toward array size.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_size(ARRAY[1, NULL, 2]) AS elements;
```

| elements |
| - |
| 3 |

### Count strings including NULL

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_size(ARRAY('red', CAST(NULL AS VARCHAR), 'blue')) AS element_count;
```

| element\_count |
| - |
| 3 |

## Limitations

* The size is returned as an unsigned 64-bit integer, even when query tools report INTEGER. Some nonstandard array storage formats can raise an error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.