# Redpanda SQL vs PostgreSQL

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: Redpanda SQL vs PostgreSQL
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: get-started/redpanda-sql-vs-postgresql
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: get-started/redpanda-sql-vs-postgresql.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/sql/pages/get-started/redpanda-sql-vs-postgresql.adoc
description: Comparison of Redpanda SQL and PostgreSQL covering supported functions, operators, and behavioral differences.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/sql/get-started/redpanda-sql-vs-postgresql.md -->

Redpanda SQL aims for close compatibility with PostgreSQL syntax and semantics, yet differs significantly in design and function. Use this page to check which features are supported and where Redpanda SQL diverges from PostgreSQL.

PostgreSQL is an online transactional processing (OLTP) database by default, whereas Redpanda SQL is an online analytical processing (OLAP) query engine. For more on the distinction, see [OLTP vs OLAP](https://docs.redpanda.com/cloud-data-platform/sql/get-started/oltp-vs-olap/).

Redpanda SQL doesn’t support common PostgreSQL transaction-processing operations like direct writes or upserts.

Instead, Kafka-compatible producers write topics into Redpanda Streaming. From there, Redpanda SQL queries topics in log form using local or object storage (the "hot" tier), as well as corresponding Apache Iceberg tables in columnar form (the "cold" tier). A single query against a linked Redpanda catalog returns records from both tiers in one result, with no overlap between the live tail and the topic’s history in Iceberg, including records older than your topic retention.

Redpanda SQL is _semantically_ compatible with PostgreSQL but not _code_ compatible. It can’t use common PostgreSQL extensions such as pgvector, PostGIS, or pg\_cron.

## [](#json-operators)JSON operators

Redpanda SQL supports operators for handling JSON data in a slightly different way than PostgreSQL.

### [](#equal-operator)Equal operator (`=`)

This operator checks if two JSON values are identical. In Redpanda SQL, two JSON objects are considered equal only when their key-value pairs appear in the exact same order.

```sql
SELECT '{"a":1, "b":"c"}'::json = '{"b":"c", "a":1}'::json;
```

Result:

```sql
 ?column?
----------
 f
(1 row)
```

In PostgreSQL, the `=` operator is not order-sensitive, so the order of key-value pairs does not affect the comparison result.

## [](#behavioral-differences)Behavioral differences

### [](#output-header)Output header

PostgreSQL includes the function name in the output header:

```sql
SELECT COS(0), LN(1);
```

```sql
 cos | ln
-----+----
   1 |  0
```

Redpanda SQL uses generic column names instead:

```sql
SELECT COS(0), LN(1);
```

```sql
 f | f_1
---+-----
 1 |   0
```

### [](#abs-output)ABS output

The `abs` function returns different results for decimal inputs:

```sql
SELECT ABS(-1.0);
```

-   Redpanda SQL returns `1`

-   PostgreSQL returns `1.0`


## [](#error-handling-differences)Error-handling differences

| Function | Input | Output (Redpanda SQL) | Output (PostgreSQL) |
| --- | --- | --- | --- |
| LN | LN(0) | Infinity | ERROR: cannot take the logarithm of zero |
| LN | LN(0.0) | Infinity | ERROR: cannot take the logarithm of zero |
| LOG10 | LOG10(-1) | NaN | ERROR: cannot take logarithm of a negative number |
| SQRT | SQRT(-1) | input is out of range | ERROR: cannot take the square root of a negative number |
| SIN | SELECT sin(pi()/2); | unknown function pi | working as expected |

## [](#suggested-reading)Suggested reading

-   [Redpanda SQL Overview](https://docs.redpanda.com/cloud-data-platform/sql/get-started/overview/)

-   [OLTP vs OLAP](https://docs.redpanda.com/cloud-data-platform/sql/get-started/oltp-vs-olap/)

-   [Redpanda SQL Reference](https://docs.redpanda.com/cloud-data-platform/reference/sql/)