Needs advice
on
PostgreSQLPostgreSQL
and
PrestoPresto

Hello experts,

I am trying to get a comprehensive list of the differences in syntax between Presto and PostgreSQL.

Is there an official documentation where I can find it? Is one a subset of another (as in all commands of presto are in Postgres or vice versa)?

READ LESS
3 upvotes·22.5K views
Replies (1)
Senior Software Engineer ·
Recommends
on
Presto

This is a bit difficult to answer since Postgres is a database and Presto is a query engine, so Presto can be used to query a Postgres database (as well as many other data sources). However if you are strictly looking to execute an identical SQL statement via both Postgres and Presto, I suggest evaluating the SQL statement in terms of ANSI compliance. Presto is fully ANSI-compliant, so any ANSI SQL statement will execute using Presto. Postgres is mostly ANSI-compliant, so an ANSI SQL statement that is within the conformance specified by Postgres will be executable by both Presto and Postgres. But a Postgres query using non-ANSI SQL may not be executable by Presto, and a Presto query that uses one of the ANSI standards not supported by Postgres may not be executable by Postgres. I also recommend reading about Presto's query execution model and in particular the difference between statements (i.e. raw SQL text) and queries. Because of the way Presto converts statements to queries, even though you can generally copy a SQL statement from Postgres to Presto, optimizing that query for Presto may require significant changes in syntax. If you want to maximize compatibility, using Presto as your query engine will allow you to query your data whether you choose to store it in Postgres or elsewhere.

READ MORE
4 upvotes·11 views
Avatar of Deven Mehta