[Doc] column_size and column_compressed_size functions (#63665)

Signed-off-by: 絵空事スピリット <wanglichen@starrocks.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: 絵空事スピリット <wanglichen@starrocks.com>
This commit is contained in:
Murphy 2025-09-29 14:30:23 +08:00 committed by GitHub
parent 6285f40901
commit f9106d3c03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 195 additions and 0 deletions

View File

@ -0,0 +1,65 @@
---
displayed_sidebar: docs
---
# column_size & column_compressed_size
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
-- 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
-- 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
-- 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_];
```

View File

@ -0,0 +1,65 @@
---
displayed_sidebar: docs
---
# column_size & column_compressed_size
これらの関数は、ストレージ分析と最適化のためにテーブル列のサイズ情報を返します。両方の関数は `[_META_]` ヒントと組み合わせて使用し、セグメントファイルのメタデータを検査します。
## column_size
列の非圧縮サイズをバイト単位で返します。
### 構文
```SQL
-- ヒント内の角括弧 [] を省略しないでください。
SELECT column_size(column_name) FROM table_name [_META_];
```
### パラメータ
- `column_name`: 非圧縮サイズを取得したい列の名前。
### 戻り値
列の非圧縮サイズをバイト単位で BIGINT 値として返します。
## column_compressed_size
列の圧縮サイズをバイト単位で返します。
### 構文
```SQL
-- ヒント内の角括弧 [] を省略しないでください。
SELECT column_compressed_size(column_name) FROM table_name [_META_];
```
### パラメータ
- `column_name`: 圧縮サイズを取得したい列の名前。
### 戻り値
列の圧縮サイズをバイト単位で BIGINT 値として返します。
## 使用上の注意
- 両方の関数は `[_META_]` ヒントと組み合わせて使用し、メタデータ情報にアクセスする必要があります。
- これらの関数は META_SCAN オペレータを使用して、基盤となるセグメントファイルのメタデータをスキャンします。
- 複雑なデータ型JSON、ARRAY、MAP、STRUCTの場合、これらの関数はすべてのサブ列のサイズを再帰的に計算します。
- `column_size` は、非圧縮の列サイズを返します。
- `column_compressed_size` は、圧縮されたディスクサイズを返します。
## 例
```sql
-- 列の非圧縮サイズと圧縮サイズを取得
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_];
```

View File

@ -0,0 +1,65 @@
---
displayed_sidebar: docs
---
# column_size & column_compressed_size
这些函数返回表列的大小信息,用于存储分析和优化。两个函数都与 `[_META_]` 提示一起使用来检查 Segment 文件元数据。
## column_size
返回列的未压缩大小(以字节为单位)。
### 语法
```SQL
-- 请勿省略 Hint 中的括号[]。
SELECT column_size(column_name) FROM table_name [_META_];
```
### 参数
- `column_name`: 要获取未压缩大小的列名。
### 返回值
返回 BIGINT 值,代表列的未压缩大小(以字节为单位)。
## column_compressed_size
返回列的压缩大小(以字节为单位)。
### 语法
```SQL
-- 请勿省略 Hint 中的括号[]。
SELECT column_compressed_size(column_name) FROM table_name [_META_];
```
### 参数
- `column_name`: 要获取压缩大小的列名。
### 返回值
返回 BIGINT 值,代表列的压缩大小(以字节为单位)。
## 使用说明
- 两个函数都必须与 `[_META_]` 提示一起使用才能访问元数据信息。
- 这些函数使用 META_SCAN 操作符扫描底层段文件的元数据。
- 对于复杂数据类型JSON、ARRAY、MAP、STRUCT这些函数递归计算所有子列的大小。
- `column_size` 返回未压缩的列大小。
- `column_compressed_size` 返回压缩的磁盘大小。
## 示例
```sql
-- 获取列的未压缩和压缩大小
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_];
```