Skip to main content
Iceberg provides powerful APIs for reading table data with support for filtering, projection, time travel, and incremental scans. This guide covers the different scan types and how to use them effectively.

Table Scans

The most common way to read an Iceberg table is using a TableScan. A table scan reads the current snapshot of the table and supports various refinements.

Basic Table Scan

Projection (Column Selection)

Limit the columns read to improve performance:
You can also project using a schema:

Filtering Data

Apply row-level filters to reduce the data scanned:
Filters are pushed down to skip entire files and row groups when possible, dramatically improving query performance.
Common filter expressions:

Case Sensitivity

Control whether column name matching is case-sensitive:

Time Travel Queries

Iceberg maintains table history through snapshots, enabling queries as of a specific point in time.

Read a Specific Snapshot

Read as of Timestamp

Read Using Named References

Time travel queries depend on snapshot retention. Ensure snapshots are not expired before the desired timestamp.

Batch Scans

Batch scans are optimized for reading large amounts of data in batch processing jobs:

Incremental Scans

Read only the data that changed between two snapshots.

Incremental Append Scan

Read new rows appended between snapshots:

Incremental Changelog Scan

Read all changes (inserts, updates, deletes) between snapshots:
Incremental scans are ideal for building streaming pipelines and incremental ETL processes.

Advanced Scan Options

Planning with Custom Executor

Use a custom thread pool for scan planning:

Include Column Statistics

Load column statistics with each data file:

Ignore Residual Filters

Skip row-level filtering (filter files only):

Table Properties Override

Override table properties for a specific scan:

Planning Tasks

1

Plan individual files

Plan tasks where each task reads a single file:
2

Plan balanced task groups

Plan tasks that combine small files and split large files:
Balanced task groups improve parallelism by creating evenly-sized tasks based on read.split.target-size.

Metrics Reporting

Attach custom metrics reporters to track scan performance:
See Metrics Reporting for more details on collecting scan metrics.

Complete Example

Best Practices

  1. Use projection: Only read the columns you need to reduce I/O
  2. Apply filters early: Push down predicates to skip entire files
  3. Leverage time travel: Access historical data without maintaining separate copies
  4. Monitor metrics: Track scan performance to identify optimization opportunities
  5. Use incremental scans: For streaming and CDC use cases, process only changed data
  6. Plan balanced tasks: Use planTasks() for better parallelism in distributed engines