Skip to main content

Presto


What is Presto?


Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes...

Presto allows querying data where it lives, including Hive, Cassandra, relational databases or even proprietary data stores. A single Presto query can combine data from multiple sources, allowing for analytics across your entire organization.


Architecture


Presto system components:
Coordinator: responsible for parsing statements, planning queries, and managing Presto worker nodes.
Worker: responsible for executing tasks and processing data.
Connectors: Storage plugins are called as connectors. Hive, HBase, MySQL, Cassandra and many more act as a connector; otherwise you can also implement a custom one.


SQL Statements Cheat Sheet


1. Join
SELECT *
FROM table1
JOIN table2
ON table1.a = table2.b

2. Inner Join vs. Outer Join

3. If-else case
SELECT COUNT(CASE WHEN msg.is_true THEN 1 END)
FROM foo

4. New table
WITH new_table AS (
SELECT * FROM foo
),
another_new_table AS (
SELECT * FROM bar

Comments