Convert PostgreSQL to Amazon Redshift
A free online converter that translates PostgreSQL queries into Amazon Redshift. Paste your SQL, press Translate, and Query Studio rewrites the syntax that differs between the two databases — instantly, with no login and nothing stored.
Redshift is derived from PostgreSQL 8.0.2, which makes this migration look easier than it is. The dialect is familiar and the missing pieces are extensive — and constraints are declared but never enforced.
PostgreSQL → Amazon Redshift example
Here is a real PostgreSQL query and the Amazon Redshift output Query Studio produces:
SELECT u.id, u.name, COUNT(o.id) AS orders
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01' AND u.active = TRUE
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 3
ORDER BY orders DESC
LIMIT 10;SELECT
u.id,
u.name,
COUNT(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.created_at > '2024-01-01'
AND u.active = TRUE
GROUP BY
u.id,
u.name
HAVING
COUNT(o.id) > 3
ORDER BY
orders DESC
LIMIT
10;What changes from PostgreSQL to Amazon Redshift
- The result is re-indented and keyword-cased in Amazon Redshift style so it's ready to paste and run.
PostgreSQL to Amazon Redshift data type mapping
Query Studio translates queries, not schemas. When you come to move the tables themselves, this is what changes between PostgreSQL and Amazon Redshift:
| PostgreSQL | Amazon Redshift | Watch out for |
|---|---|---|
| TEXT | VARCHAR(65535) | Redshift has no unbounded text type and a hard 65,535-byte row limit for VARCHAR. |
| JSONB | SUPER, or VARCHAR | SUPER is the semi-structured type. Most Postgres JSONB operators do not carry over. |
| UUID | CHAR(36) | Redshift has no UUID type. |
| SERIAL | INTEGER IDENTITY(1,1) | Redshift identity values are not guaranteed gap-free or monotonic across slices. |
| TEXT[] | SUPER, or a join table | Direct equivalent. |
| TIMESTAMPTZ | TIMESTAMPTZ | Direct equivalent. |
| Foreign keys / UNIQUE | Declared but not enforced | Redshift accepts constraint syntax and does not enforce it — the planner uses it as a hint. This surprises people badly. |
PostgreSQL to Amazon Redshift: what actually catches people out
Syntax is the part a translator can fix. These are the differences that survive a clean conversion and show up later as wrong results rather than as errors.
Redshift is Postgres 8.0.2-derived, and that is a long time ago
The wire protocol and much of the syntax are familiar, which is exactly what makes this migration deceptive. Missing pieces include most JSON functions, many window function refinements, table inheritance, arrays, custom types, stored procedures in PL/pgSQL until relatively recently, and a great deal else. Familiar-looking SQL failing on a feature you assumed was ancient is the standard experience here.
Constraints are declared and not enforced
Redshift accepts PRIMARY KEY, FOREIGN KEY and UNIQUE and enforces none of them — the query planner uses them as hints. Data that violates a declared constraint will load without complaint, and a planner acting on a promise the data does not keep can produce wrong results, not just slow ones.
Distribution and sort keys replace indexes entirely
There is no CREATE INDEX. Performance comes from DISTKEY (which node a row lives on) and SORTKEY (the order within a slice), both declared at table creation. Getting them wrong is the main cause of slow Redshift, and neither has any counterpart in the Postgres schema you are migrating from.
VARCHAR lengths are counted in bytes and enforced hard
Postgres TEXT is unbounded. Redshift's maximum VARCHAR is 65,535 bytes — bytes, not characters, so a multibyte string fits fewer of them than you would expect. Data that was fine as TEXT can be rejected on load.
What this converter will not do
Query Studio translates SQL syntax. Being honest about the boundary is more useful than claiming there isn’t one — and on PostgreSQL → Amazon Redshift specifically, these are the three that matter most:
Performance characteristics
A converted query is correct, not fast. Index strategy, partitioning, distribution keys and statistics differ per engine, and a query that was well-tuned for the source is merely valid on the target. Run the Analyze and Optimize tabs on the output.
Vendor-specific extensions
PostGIS geometry, MySQL spatial functions, SQL Server's FOR XML and hierarchyid, BigQuery's nested/repeated model, Snowflake's time travel. Where there is no equivalent concept, there is no translation — only a redesign.
Stored procedures, functions and triggers
Procedural code — PL/pgSQL, T-SQL procedures, MySQL routines — is a different language in every engine, with different control flow, error handling, variable declaration and transaction semantics. Query Studio translates queries, not programs. These have to be ported by hand.
The full list of what a syntax translator cannot do is on the Query Studio page.
How to convert PostgreSQL to Amazon Redshift
- Open the Query Studio editor and choose PostgreSQL as the “From” dialect.
- Choose Amazon Redshift as the “To” dialect.
- Paste your PostgreSQL query and press Translate — copy the Amazon Redshift result.
Try it with your own query
The editor is preloaded with PostgreSQL → Amazon Redshift. You can also explain, format, validate and analyze the result.
Convert PostgreSQL to Amazon Redshift now →Working with the data rather than the schema? Open a large CSV, JSON or Parquet file and query it with SQL — no upload, no row limit, and files far past what Excel will open.
PostgreSQL to Amazon Redshift FAQ
Is this PostgreSQL to Amazon Redshift converter free?
Yes — it's completely free with no account, no sign-up and no usage limits. Your query is processed to return the result and never stored.
Is the PostgreSQL to Amazon Redshift conversion accurate?
Query Studio rewrites syntax deterministically using real SQL parsers, so it gives the same result every time — there is no AI involved and no variation between runs. It handles the differences listed above automatically. What it cannot do is anything semantic: stored procedures, triggers, vendor extensions and performance characteristics all need a human. Review complex, vendor-specific queries before running them in production.
What breaks when migrating from PostgreSQL to Amazon Redshift?
The differences that most often cause problems on this pair: Redshift is Postgres 8.0.2-derived, and that is a long time ago; Constraints are declared and not enforced; Distribution and sort keys replace indexes entirely; VARCHAR lengths are counted in bytes and enforced hard. Each is explained in full above, with before-and-after examples where seeing it is quicker than reading about it.
How do PostgreSQL data types map to Amazon Redshift?
The full mapping table is above and covers 7 types. The ones that are not a straight rename: TEXT → VARCHAR(65535), JSONB → SUPER, or VARCHAR, UUID → CHAR(36), SERIAL → INTEGER IDENTITY(1,1). Note that Query Studio translates queries rather than schemas — the table is there to tell you what your CREATE TABLE statements need, not to rewrite them for you.
Does this PostgreSQL to Amazon Redshift converter use AI?
No. Every result is computed by real SQL parsers and rule engines, which is what makes it free, instant, unlimited and identical on every run. Nothing is sent to a model, so there are no rate limits, no per-request cost to pass on, and no possibility of a confidently wrong answer that looks plausible.