Updated on 2026-11-06 GMT+08:00

Iceberg Table Query and Write

Querying an Iceberg Table

You can query data in an Iceberg table. For details about the syntax, see SELECT.

Iceberg v3 tables support the query of system columns _rowid and _last_updated_sequence_number.

Note:

Only the latest committed data can be queried.

Example:

1
SELECT * FROM iceberg_ext order by col1;

Writing to an Iceberg Table

You can insert one or more rows of data to an Iceberg table. For details about the syntax, see INSERT.

Note:

  • Frequent insertion of small data may lead to the issue of small files. You are advised to periodically rewrite data/manifest files to maintain storage and query efficiency.
  • When a DML transaction is committed, the engine may automatically schedule a background manifest rewrite (compaction) to reduce the number of small manifest files and help prevent query performance degradation over time.
  • Currently, data files can only be written in Parquet format.

Example:

1
2
3
INSERT INTO iceberg_ext VALUES (1, 'a', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT OVERWRITE INTO iceberg_ext VALUES (1, 'b', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT INTO iceberg_ext (col1, col2, col3, col4, col5, col6) SELECT col1, col2, col3, col4, col5, col6 FROM iceberg_table WHERE col1 > 18;

Deleting Data from an Iceberg Table

You can delete one or more rows from an Iceberg table. For details about the syntax, see DELETE.

Note:

  • Currently, only the merge-on-read approach is supported for delete operations.
  • When performing deletions concurrently with updates or other deletions, specify partition conditions to minimize conflicts.
  • For deleting entire partitions, the operation may be optimized by marking metadata states. To check if optimization applies, use EXPLAIN DELETE and look for the keyword "Do speed up for delete". If enabled, the returned row count might exceed the actual number of deleted rows.

Example:

1
DELETE FROM iceberg_ext where a = 1;

Updating Data in an Iceberg Table

You can update one or more rows in an Iceberg table. For details about the syntax, see UPDATE.

Note:

  • Currently, only the merge-on-read approach is supported for update operations.
  • When updating data concurrently with deletions or other updates, specify partition conditions to minimize conflicts.

Example:

1
UPDATE iceberg_ext set b = 1 where a = 1;

Merging Iceberg Tables

You can merge one Iceberg table with another. For details about the syntax, see MERGE INTO.

Note:

Currently, only the merge-on-read approach is supported for merge operations.

Example:

1
MERGE into t_iceberg p1 using t_iceberg p2 on (p1.a = p2.c) when matched then delete;