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

# column_size & column_compressed_size

> These functions return the size information of table columns for storage analysis and optimization.

These functions return the size information of table columns for storage analysis and optimization. Both functions work with the `[_META_]` hint to inspect segment file metadata.

## column\_size

Returns the decompressed size of a column in bytes.

### Syntax

```SQL theme={null}
-- Do not omit the brackets [] in the hint.
SELECT column_size(column_name) FROM table_name [_META_];
```

### Parameters

* `column_name`: The name of the column for which you want to get the decompressed size.

### Return value

Returns the decompressed size of the column in bytes as a BIGINT value.

## column\_compressed\_size

Returns the compressed size of a column in bytes.

### Syntax

```SQL theme={null}
-- Do not omit the brackets [] in the hint.
SELECT column_compressed_size(column_name) FROM table_name [_META_];
```

### Parameters

* `column_name`: The name of the column for which you want to get the compressed size.

### Return value

Returns the compressed size of the column in bytes as a BIGINT value.

## Usage notes

* Both functions must be used with the `[_META_]` hint to access metadata information.
* The functions scan the metadata of underlying segment files using the META\_SCAN operator.
* For complex data types (JSON, ARRAY, MAP, STRUCT), the functions recursively calculate the size of all sub-columns.
* `column_size` returns the uncompressed column size.
* `column_compressed_size` returns the compressed on-disk size.

## Examples

```sql theme={null}
-- Get both decompressed and compressed sizes of columns
SELECT 
    column_size(name) as name_decompressed_size,
    column_compressed_size(name) as name_compressed_size,
    column_size(description) as desc_decompressed_size,
    column_compressed_size(description) as desc_compressed_size
FROM products [_META_];
```


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