How Query Engines Work
$19.99
Minimum price
$29.99
Suggested price

How Query Engines Work

An Introductory Guide

About the Book

Andy Grove has worked on numerous projects that required custom query engines or integrations with existing query engines and this book provides an approachable introduction to the topic.

The book provides an introduction to the high-level concepts behind query engines and walks through every step of building a SQL query engine in Kotlin with full source code available in a companion github repository. Most of the book is programming language agnostic and Kotlin was chosen for the code examples due to its conciseness and readability. The concepts should be easily translatable to other programming languages.

Andy is a PMC member of Apache Arrow where he donated the initial Rust implementation and later donated the DataFusion query engine.

Please note that this is a short introductory book (around 100 pages). Around 4% of readers ask for a refund because they were expecting something far more comprehensive.

  • Share this book

  • Categories

    • Databases
    • Distributed Systems
    • Software Architecture
  • Feedback

    You must own a copy of this Book to access the forums.

    Email the Author(s)

About the Author

Andy Grove
Andy Grove

Andy Grove is a PMC member of Apache Arrow where he donated the initial Rust implementation and also donated the DataFusion query engine.

Table of Contents

  • Acknowledgments
  • Introduction
    • Feedback
  • 1 What Is a Query Engine?
    • 1.1 Why Are Query Engines Popular?
    • 1.2 What This Book Covers
    • 1.3 Source Code
    • 1.4 Why Kotlin?
  • 2 Apache Arrow
    • 2.1 Arrow Memory Model
    • 2.2 Inter-Process Communication (IPC)
    • 2.3 Compute Kernels
    • 2.4 Arrow Flight Protocol
    • 2.5 Arrow Flight SQL
    • 2.6 Query Engines
  • 3 Choosing a Type System
    • 3.1 Row-Based or Columnar?
    • 3.2 Interoperability
    • 3.3 Type System
  • 4 Data Sources
    • 4.1 Data Source Interface
    • 4.2 Data Source Examples
  • 5 Logical Plans & Expressions
    • 5.1 Printing Logical Plans
    • 5.2 Serialization
    • 5.3 Logical Expressions
    • 5.4 Column Expressions
    • 5.5 Literal Expressions
    • 5.6 Binary Expressions
    • 5.7 Comparison Expressions
    • 5.8 Boolean Expressions
    • 5.9 Math Expressions
    • 5.10 Aggregate Expressions
    • 5.11 Logical Plans
    • 5.12 Scan
    • 5.13 Projection
    • 5.14 Selection (also known as Filter)
    • 5.15 Aggregate
  • 6 Building Logical Plans
    • 6.1 Building Logical Plans The Hard Way
    • 6.2 Building Logical Plans using DataFrames
  • 7 Physical Plans & Expressions
    • 7.1 Physical Expressions
    • 7.2 Column Expressions
    • 7.3 Literal Expressions
    • 7.4 Binary Expressions
    • 7.5 Comparison Expressions
    • 7.6 Math Expressions
    • 7.7 Aggregate Expressions
    • 7.8 Physical Plans
    • 7.9 Scan
    • 7.10 Projection
    • 7.11 Selection (also known as Filter)
    • 7.12 Hash Aggregate
    • 7.13 Joins
    • 7.14 Subqueries
    • 7.15 Creating Physical Plans
  • 8 Query Planner
    • 8.1 Translating Logical Expressions
    • 8.2 Column Expressions
    • 8.3 Literal Expressions
    • 8.4 Binary Expressions
    • 8.5 Translating Logical Plans
    • 8.6 Scan
    • 8.7 Projection
    • 8.8 Selection (also known as Filter)
    • 8.9 Aggregate
  • 9 Query Optimizations
    • 9.1 Rule-Based Optimizations
    • 9.2 Cost-Based Optimizations
  • 10 Query Execution
    • 10.1 Apache Spark Example
    • 10.2 KQuery Examples
    • 10.3 Removing The Query Optimizer
  • 11 SQL Support
    • 11.1 Tokenizer
    • 11.2 Pratt Parser
    • 11.3 Parsing SQL Expressions
    • 11.4 Parsing a SELECT statement
    • 11.5 SQL Query Planner
    • 11.6 Translating SQL Expressions
    • 11.7 Planning SELECT
    • 11.8 Planning for Aggregate Queries
  • 12 Parallel Query Execution
    • 12.1 Combining Results
    • 12.2 Smarter Partitioning
    • 12.3 Partition Keys
    • 12.4 Parallel Joins
  • 13 Distributed Query Execution
    • 13.1 Embarrassingly Parallel Operators
    • 13.2 Distributed Aggregates
    • 13.3 Distributed Joins
    • 13.4 Distributed Query Scheduling
    • 13.5 Producing a Distributed Query Plan
    • 13.6 Serializing a Query Plan
    • 13.7 Serializing Data
    • 13.8 Choosing a Protocol
    • 13.9 Streaming
    • 13.10 Custom Code
    • 13.11 Distributed Query Optimizations
  • 14 Testing
    • 14.1 Unit Testing
    • 14.2 Integration Testing
    • 14.3 Fuzzing
  • 15 Benchmarks
    • 15.1 Measuring Performance
    • 15.2 Measuring Scalability
    • 15.3 Concurrency
    • 15.4 Automation
    • 15.5 Comparing Benchmarks
    • 15.6 Publishing Benchmark Results
    • 15.7 Transaction Processing Council (TPC) Benchmarks
  • Further Resources
    • Open-Source Projects
    • YouTube
    • Sample Data

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub