Modern applications often need to work with two very different types of data.

Operational data belongs in systems designed for fast application transactions. Customer records, orders, payments, inventory, and account information are common examples.

Analytical data has different requirements. Large event histories, logs, clickstream records, historical transactions, and machine-generated data may need to be stored for long periods and queried across large datasets.

Apache Iceberg is designed for this analytical side of the architecture. It provides a table format for large analytical datasets stored in object storage and accessed by engines such as Spark, Trino, Flink, and other compatible systems.

PostgreSQL, on the other hand, is commonly used by applications for transactional workloads. Developers naturally want to query operational and analytical data together, but copying everything from an Iceberg lakehouse into PostgreSQL is usually not a good solution.

A better architecture is to keep each workload in the system designed for it and provide a controlled way for PostgreSQL workloads to access Iceberg data when required.

This article explains the architecture behind querying Iceberg data from PostgreSQL-oriented workloads, how the data path works, where PostgreSQL fits, what the performance considerations are, and when this approach makes sense.

What Is Apache Iceberg?

Apache Iceberg is an open table format designed for large analytical datasets.

It is not a database server.

An Iceberg table normally consists of data files stored in object storage together with metadata describing the table.

A simplified architecture looks like this:

Code
Application
     |
     v
PostgreSQL
     |
     | Operational queries
     v
Transactional tables


Analytical workloads
     |
     v
Iceberg table
     |
     v
Object Storage
     |
     v
Data files

The important difference is that Iceberg provides table-level metadata and consistency on top of data stored in files.

Instead of treating a directory of Parquet files as an unmanaged collection of files, an Iceberg table keeps track of the table's structure, snapshots, schemas, partitions, and changes.

This makes large analytical datasets easier to manage over time.

Why PostgreSQL Workloads May Need Iceberg Data

Consider an e-commerce application.

PostgreSQL may contain current operational information:

Code
customers
orders
products
payments
inventory

The company may also have billions of historical events:

Code
page views
search events
product impressions
checkout events
application logs
device events
historical order events

Keeping all of this historical data inside PostgreSQL may increase storage requirements and make large analytical queries compete with application traffic.

Instead, historical event data can be written into an Iceberg table.

The architecture can then look like this:

SQL
                    +------------------+
                    |   Application    |
                    +--------+---------+
                             |
                             v
                    +------------------+
                    |    PostgreSQL    |
                    | Operational Data|
                    +------------------+

                             |
                             | Analytical access
                             v

                    +------------------+
                    | Iceberg Tables   |
                    +--------+---------+
                             |
                             v
                    +------------------+
                    | Object Storage   |
                    +------------------+

PostgreSQL remains responsible for transactional workloads while the lakehouse handles large analytical datasets.

PostgreSQL and Iceberg Solve Different Problems

It is important not to think of Iceberg as a replacement for PostgreSQL.

The systems are designed around different workload patterns.

Requirement

PostgreSQL

Apache Iceberg

OLTP transactions

Strong fit

Not the primary purpose

Small point lookups

Strong fit

Usually not the best choice

Frequent updates

Strong fit

Supported through table operations but optimized differently

Large analytical scans

Possible but can become expensive

Strong fit

Object storage

External integration

Core storage model

Historical analytical data

Possible

Strong fit

Complex lakehouse workloads

Limited compared with analytical engines

Strong fit

Application request processing

Strong fit

Usually not the primary workload

The goal is not to make one system perform every type of workload.

The goal is to connect them when business requirements need data from both.

How Iceberg Tables Store Data

A typical Iceberg table may use Parquet files for the actual data.

A simplified table might look like:

Code
sales/
    metadata/
        ...
    data/
        part-00001.parquet
        part-00002.parquet
        part-00003.parquet

The metadata provides information about the table and its snapshots.

The application should not normally treat those files as ordinary files and manually query them.

Instead, an Iceberg-aware engine uses the table metadata to understand which files belong to a particular table snapshot.

This distinction is important.

If a PostgreSQL workload needs Iceberg data, it should use a compatible query layer or connector rather than bypassing Iceberg's metadata management.

PostgreSQL Does Not Directly Become an Iceberg Engine

One of the most important architectural points is that PostgreSQL itself is not automatically an Iceberg query engine.

A PostgreSQL-based application may access Iceberg through another layer.

For example:

Code
PostgreSQL Workload
        |
        v
Federation / Query Layer
        |
        v
Iceberg Catalog
        |
        v
Object Storage
        |
        v
Parquet Data

The exact implementation depends on the PostgreSQL distribution, extensions, federation technology, and analytical engine used by the environment.

This layer is responsible for translating the query or data access request into operations that the Iceberg storage and query engine can execute.

Therefore, when designing this architecture, do not assume that installing a PostgreSQL extension automatically turns PostgreSQL into a full Iceberg processing engine.

A Practical Query Flow

Suppose the application needs to answer this question:

"How many orders did each customer make during the last quarter?"

The current customer and order information may be stored in PostgreSQL.

Historical event information may be stored in Iceberg.

A federated query architecture could conceptually perform the following:

Code
1. PostgreSQL receives the query
             |
             v
2. Query planner identifies external data
             |
             v
3. Federation layer sends analytical operation
             |
             v
4. Iceberg query engine reads required files
             |
             v
5. Iceberg engine performs filtering and aggregation
             |
             v
6. Result is returned to PostgreSQL workload

The important part is that PostgreSQL does not need to copy the entire Iceberg table into local tables just to answer the question.

Keep Filtering Close to the Iceberg Data

Large analytical datasets can contain billions of rows.

Sending unnecessary data across the network can quickly become expensive.

Suppose the Iceberg table contains five years of order history, but the application only needs one month.

A poor query strategy may scan and transfer a large amount of data before filtering.

A better strategy is to push filtering into the analytical layer:

SQL
SELECT
    customer_id,
    COUNT(*) AS order_count
FROM external_orders
WHERE order_date >= DATE '2026-10-01'
  AND order_date < DATE '2026-11-01'
GROUP BY customer_id;

The exact SQL support depends on the federation layer and query engine.

The architectural principle is more important than the syntax.

Filter early.

Project only the columns you need.

Aggregate data before transferring large result sets back to PostgreSQL.

This reduces network traffic and improves query efficiency.

Avoid SELECT * for Large Iceberg Tables

A query like this:

SQL
SELECT *
FROM external_orders;

may be harmless against a small table.

It can be a serious problem against an analytical dataset containing billions of rows.

If the application only needs three columns, request three columns:

SQL
SELECT
    customer_id,
    order_date,
    amount
FROM external_orders
WHERE order_date >= DATE '2026-10-01';

Columnar formats such as Parquet are particularly useful when queries read only a subset of columns.

The query engine can often avoid reading unrelated columns from the underlying files.

This is one of the basic principles that makes analytical lakehouse storage efficient.

Partitioning and File Layout Matter

Iceberg supports partitioning strategies that help query engines identify relevant data.

For example, a table may be logically partitioned by a transformed date value.

The application may frequently query:

Code
order_date
region
customer_id
event_type

The table design should reflect actual query patterns rather than simply creating a partition for every available column.

Too many small partitions can create metadata and file-management overhead.

Poor partition choices can also cause large scans.

The important principle is to design the Iceberg table around real analytical access patterns.

Do not treat partitioning as a cosmetic database setting.

Avoid the Small File Problem

Analytical pipelines can accidentally create thousands or millions of tiny files.

For example:

Code
data/
    file001.parquet
    file002.parquet
    file003.parquet
    ...
    file900000.parquet

Even if the total data volume is reasonable, the query engine may spend significant time discovering, opening, and processing the files.

This is commonly called the small file problem.

A production pipeline should therefore include appropriate compaction or file management.

The goal is to maintain a practical file layout that allows analytical engines to process the data efficiently.

Joining PostgreSQL Data With Iceberg Data

One of the more interesting use cases is joining operational PostgreSQL data with historical Iceberg data.

Suppose PostgreSQL contains:

Code
customers

while Iceberg contains:

Code
customer_events

A business report may need information from both.

Conceptually:

SQL
SELECT
    c.customer_id,
    c.name,
    COUNT(e.event_id) AS event_count
FROM customers c
JOIN external_customer_events e
    ON e.customer_id = c.customer_id
GROUP BY
    c.customer_id,
    c.name;

Whether this exact query is efficient depends heavily on the federation engine and query planner.

A join between a small PostgreSQL table and a very large Iceberg table can be reasonable when filters reduce the Iceberg side first.

A join that transfers billions of rows between systems is a different problem.

This is why query planning matters.

Push Predicates Before the Join

Suppose only events from a particular date range are needed.

Instead of conceptually doing:

Code
All Iceberg events
        |
        v
Join with PostgreSQL
        |
        v
Filter dates

you want the analytical side to reduce the dataset first:

Code
Iceberg events
        |
        v
Filter date range
        |
        v
Reduce data
        |
        v
Join with PostgreSQL

This can dramatically reduce the amount of data involved in the join.

The exact behavior depends on the query engine, so always inspect query plans and actual execution behavior rather than assuming that predicate pushdown happened.

Be Careful With High-Cardinality Joins

Joining on customer IDs can become expensive when both sides contain large numbers of rows.

For example:

Code
PostgreSQL
10 million customers

Iceberg
20 billion events

A direct join over the complete datasets may not be appropriate for an application request.

Instead, consider filtering first.

For example:

Code
Request
   |
   v
Customer segment
   |
   v
Relevant customer IDs
   |
   v
Iceberg event filter
   |
   v
Aggregation
   |
   v
Small result
   |
   v
PostgreSQL application

This design is much more practical for interactive workloads.

Choose the Right Workload Boundary

Not every Iceberg query belongs inside an application request.

A report that takes several minutes may be perfectly acceptable for a scheduled analytics job but inappropriate for an API endpoint expected to return within a few hundred milliseconds.

Use different execution patterns for different workloads.

For interactive requests:

Code
Small input
Small scan
Small result
Fast response

For analytics:

Code
Large input
Large scan
Complex aggregation
Longer execution time

Trying to force both patterns through the same application endpoint can create reliability problems.

Use Pre-Aggregated Data for Frequently Requested Metrics

If an application repeatedly asks for the same analytical calculation, consider pre-aggregating the data.

Instead of calculating:

Code
Billions of raw events
        |
        v
Group by customer
        |
        v
Calculate metrics

for every request, a pipeline can maintain an aggregated dataset:

Code
Raw Iceberg Events
        |
        v
Aggregation Pipeline
        |
        v
Customer Metrics Table

The application then queries the smaller dataset.

This is often a better architecture for dashboards and frequently requested business metrics.

Transactional Workloads Should Stay Transactional

A common mistake is moving operational application data into Iceberg simply because the lakehouse can store large amounts of information.

Consider a payment workflow.

The application may need to:

  1. Validate a payment.

  2. Update an order.

  3. Update inventory.

  4. Record the transaction.

  5. Return a response.

This workflow needs transactional guarantees and predictable application behavior.

PostgreSQL is a much more natural fit for this workload.

Iceberg is better suited to large analytical datasets and historical data.

A healthy architecture might therefore look like:

Code
Application Transactions
        |
        v
PostgreSQL
        |
        | CDC / Data Pipeline
        v
Iceberg
        |
        v
Analytical Workloads

This keeps operational and analytical responsibilities separate.

Security Considerations

Connecting PostgreSQL-oriented workloads to an Iceberg environment introduces additional security boundaries.

The query layer may need access to:

  • Iceberg catalogs.

  • Object storage.

  • Table metadata.

  • Data files.

  • Credentials or service identities.

Access should follow least-privilege principles.

A reporting workload should not automatically receive write access to every Iceberg table.

Similarly, credentials used to access object storage should not be embedded directly into application code.

Use the authentication and authorization mechanisms provided by the deployment environment.

Also consider data classification.

Analytical datasets often contain historical customer activity, logs, and operational records. Moving that data into a lakehouse does not remove the responsibility to protect it.

Monitoring Cross-System Queries

When a query crosses PostgreSQL and Iceberg, monitoring needs to cover the entire path.

A slow query could be caused by:

Code
PostgreSQL planning
        |
        v
Federation layer
        |
        v
Iceberg metadata lookup
        |
        v
Object storage
        |
        v
Parquet scan
        |
        v
Aggregation
        |
        v
Network transfer
        |
        v
PostgreSQL result processing

Looking only at PostgreSQL query latency may not tell you where the actual problem occurred.

Useful metrics include:

  • Query duration.

  • Rows scanned.

  • Rows returned.

  • Data transferred.

  • Number of files accessed.

  • Metadata operations.

  • Object storage latency.

  • Join size.

  • Memory usage.

  • Spill activity where supported.

This gives the team enough information to identify whether the problem is query design, data layout, network transfer, or infrastructure.

Common Mistakes

Treating Iceberg Like a Normal PostgreSQL Table

An Iceberg table has different storage and execution characteristics.

Queries should be designed with analytical workloads in mind.

Transferring Large Result Sets

Returning millions of rows from an analytical engine to PostgreSQL defeats many of the benefits of the architecture.

Filter and aggregate before transferring data whenever possible.

Using SELECT *

Large analytical datasets can contain many columns that the application does not need.

Select only the required columns.

Ignoring Table Maintenance

Poor file layouts, excessive small files, and unmanaged table metadata can eventually affect query performance.

Lakehouse tables need operational maintenance just like other data systems.

Using Analytical Queries in Latency-Sensitive APIs

A complex query over billions of historical records may not belong in a synchronous API request.

Consider pre-aggregation, caching, asynchronous processing, or dedicated reporting workflows.

Giving Excessive Storage Permissions

The query layer should receive only the permissions it actually needs.

Avoid granting broad object-storage access simply because it makes configuration easier.

Best Practices

Keep PostgreSQL responsible for transactional application workloads.

Use Iceberg for large analytical and historical datasets.

Use a supported query or federation layer to connect PostgreSQL workloads with Iceberg rather than bypassing Iceberg metadata.

Push filters and projections toward the analytical engine.

Avoid transferring large intermediate datasets between systems.

Design Iceberg partitions around real query patterns.

Monitor and manage small files.

Use pre-aggregated datasets for frequently requested metrics.

Separate interactive API workloads from long-running analytical workloads.

Apply least-privilege security to catalogs, storage, and query services.

Monitor the complete cross-system query path.

Test representative workloads before moving production queries into the federation architecture.

Advantages and Disadvantages

Area

Advantages

Disadvantages

Data architecture

Keeps operational and analytical workloads separate

Adds another system to operate

Storage

Iceberg can manage large datasets on object storage

Requires table and storage management

Analytics

Good fit for large historical datasets

Not designed as a replacement for OLTP

PostgreSQL integration

Applications can access analytical data without copying everything locally

Cross-system queries can be complex

Scalability

Analytical processing can scale independently

Performance depends on the query engine and data layout

Cost management

Historical data can be stored efficiently in object storage

Poor query design can increase storage and compute costs

Flexibility

Supports multiple analytical engines

Requires compatible catalog and query infrastructure

When This Architecture Makes Sense

Querying Iceberg data from PostgreSQL-oriented workloads makes sense when an application needs access to large analytical datasets without turning PostgreSQL into the primary storage system for that data.

Good examples include:

  • Customer activity analysis.

  • Historical order analysis.

  • Application event reporting.

  • Product usage analytics.

  • Long-term audit analysis.

  • Operational dashboards combining current and historical information.

  • Analytics over large event streams.

It is less appropriate when the application requires frequent row-level transactions, strict request latency, or highly interactive updates against the same dataset.

In those situations, PostgreSQL should generally remain responsible for the operational workload.

A Practical Architecture

A production architecture can separate the responsibilities clearly:

SQL
                    Application
                         |
                         v
                +----------------+
                |   PostgreSQL   |
                | Operational DB |
                +--------+-------+
                         |
                         | Data pipeline / CDC
                         v
                +----------------+
                | Iceberg Tables |
                +--------+-------+
                         |
                         v
                +----------------+
                | Object Storage |
                +----------------+

Application / Reporting
          |
          v
Query / Federation Layer
          |
          +---------> PostgreSQL
          |
          +---------> Iceberg

The important design decision is not simply connecting two databases.

It is deciding which system should own which workload.

PostgreSQL should remain focused on application transactions and operational state.

Iceberg should handle large analytical datasets where its table format and object-storage architecture provide value.

A query layer can then connect the two when a business operation genuinely needs data from both.

Summary

Apache Iceberg provides a structured table format for large analytical datasets stored in object storage. PostgreSQL remains a strong choice for transactional application workloads. These technologies can work together when applications need to combine operational information with historical or analytical data.

The safest approach is to keep the workload boundaries clear. PostgreSQL should not be forced to store and process every historical event simply because the application already uses PostgreSQL. At the same time, Iceberg should not be treated as a replacement for transactional database operations.

A federation or query layer can provide the bridge between the two environments. When using this architecture, filtering, projection, aggregation, partitioning, file management, and query planning become especially important because data may move across multiple systems.

The most important principle is to process data as close as possible to where it is stored, transfer only what is required, and choose the execution model based on the workload.

When designed this way, PostgreSQL and Iceberg can serve different parts of the same application architecture without forcing one platform to handle workloads it was not designed to manage.