Presto

Presto is an open source distributed SQL query engine for running interactive analytic queries against heterogeneous data sources. It was open sourced by Facebook in 2013. Although it is also known as PrestoDB, Presto is not a general-purpose database management system (DBMS). It does not manage the storage of data. Instead, Presto is a query engine which allows querying data where it lives, including Hive, Cassandra, Kafka, and relational databases. A single Presto query is able to combine data from multiple sources. Presto was designed, built and optimized for interactive queries. In comparison, both Presto and Hive support SQL queries against HDFS, while Presto is targeted at interactive queries and Hive is suitable for batch processing. Presto supports ANSI-compatible SQL statements.

History

Presto started out as a project at Facebook. Prior to Presto, Facebook primarily used Hive, but it wasn't optimized for high speed interactive queries. The development of Presto finished in 2012, and it was rolled out to the company in early 2013. Facebook open-sourced Presto in November 2013 under the Apache Software License.

Checkpoints

Not Supported

Presto does not support checkpointing, or any other forms of fault-tolerance as of late 2018. As is the case for many OLAP database management systems, Presto assumes that the nodes will not fail during the execution. The client has to rerun the entire query once failure occurs.

Compression

Dictionary Encoding Run-Length Encoding

Presto can operate on dictionary and run-length-encoded blocks from connectors. When generating intermediate results, Presto also produces compressed data in the form of dictionary or run-length-encoded blocks.

Concurrency Control

Not Supported

Presto is a query engine designed for query large amounts of data, and it does not support updating the data that it queries. As a result, concurrency control is not needed for the usages of Presto.

Data Model

Column Family Relational Key/Value Document / XML

Presto provides connectors to different data sources, and each connector is implemented to be compatible with the data model of the underlying database. Thus, Presto supports different types of data models, including column family, document/XML, key/value and relational.

Indexes

Not Supported

Presto does not support indexes. All intermediate processing and storage are done in the memory to avoid unnecessary I/O overheads.

Isolation Levels

Read Uncommitted Read Committed Serializable Repeatable Read

Depending on the underlying source of data, whether or not transaction is supported depends on the implementation of the specific connector. For the connectors that support transactions, Presto API supports 4 different types of isolation levels. The isolation level is to be specified when a transaction is started.

Joins

Hash Join Broadcast Join Shuffle Join

Presto has two types of join distributions. It can support both broadcast join and partitioned (shuffle) join. The join distribution can either be specified by the user or be decided by the cost-based optimization strategies that are supported by Presto. At each node level, Presto performs a hash-based join.

Logging

Not Supported

By default, Presto does not support logging. Customized tools can be added to Presto to log the events and queries at the node level.

Query Compilation

Code Generation JIT Compilation

Presto uses code generation targeting JVM bytecode. To do this, it can evaluate expressions, and also use heuristics to generate code that are compatible with the optimization of the JIT compilers, thus providing better performance.

Query Execution

Materialized Model

Presto uses the materialized model and emits the entire result at a time. The result is then stored in the memory and the coordinator decides its usage.

Query Interface

SQL

Presto follows the ANSI SQL specification. To improve usability, Presto also supports anonymous functions and built-in higher-order functions, including transform, filter and reduce.

Storage Architecture

In-Memory

Presto is designed to query data from sources including Hadoop environments and other relational database systems, so it does not directly take the role of data storage. All data and the intermediate results are stored in-memory whenever possible. For communication between nodes, data is also stored in in-memory buffers and sent through the network. This avoids the high cost of I/O operations and speeds up the execution. For memory-intensive queries, Presto also offers the functionality of spilling data to disk. But this is not a primary function of Presto and it is assumed that most of the query operations should be performed in-memory completely.

Storage Model

Decomposition Storage Model (Columnar)

To execute a query, Presto splits the assignments to each worker, and the workers fetch the data from the data sources. The unit of data that Presto locally operates on is called a page. The page is a columnar of a sequence of rows.

Stored Procedures

Supported

Stored procedures may be provided by the connectors to data sources. Presto provides a "call" statement to invoke a procedure. However, some systems, such as PostgreSQL, have their own stored procedures that are not directly callable by Presto.

System Architecture

Shared-Nothing

As similar to many classic MPP (massively parallel process) database management systems, Presto utilizes a shared-nothing system architecture. Presto is deployed on a cluster of nodes. A node can take the role of either a coordinator or a worker. Each node has its own private disk and memory, and the user can configure the memory usage of each node. Since Presto does not store data directly, the disk of each node is used minimally for storing logs only, and all communications are done through the network.

Views

Virtual Views

Presto provides functions to store the view as a logical table that can be used by future queries. The view does not contain any data, meaning that the query that generates the view has to be executed when the view is referenced.

Derivative Systems

People Also Viewed

Presto Logo
Website

http://prestosql.io

Source Code

https://github.com/prestosql/presto

Tech Docs

https://prestosql.io/docs/current/

Developer

Presto Open Source Community

Country of Origin

US

Start Year

2013

Project Type

Open Source

Written in

Java

Supported languages

SQL

Compatible With

Accumulo, Cassandra, Elasticsearch, Hive, Kudu, MongoDB, MySQL, Pinot, PostgreSQL, Redis, Redshift

Operating Systems

All OS with Java VM

Licenses

Apache v2

Wikipedia

https://en.wikipedia.org/wiki/Presto_(SQL_query_engine)

Derivative Systems

People Also Viewed