DuckDB V2 PEG-based SQL parser
DuckDB has released version 2.0, which features a new PEG-based SQL parser designed for easier evolution and runtime extensibility. This update replaces the previous PostgreSQL-derived parser to better support DuckDB's unique SQL dialect and features.
Why it matters
Improving database parsing efficiency and flexibility is critical for high-performance data analytics and the evolution of modern database systems.
TL;DR: DuckDB v2.0 replaces its PostgreSQL-derived SQL parser with a PEG-based parser that is easier to evolve and can be extended at runtime.
At DuckDB, one of our goals is to make working with a database system as easy as possible. Users interact with the system through the widely understood Structured Query Language (SQL). Previous blog posts have covered DuckDB’s friendly SQL , including GROUP BY ALL and column selection using SELECT * EXCLUDE (...) . Before DuckDB can execute a query using these features, however, it first has to determine whether its syntax is valid. That is the job of the parser , and in DuckDB v2.0 we are completely replacing it without you noticing.
At a high level, DuckDB processes a SQL query through the following stages:
In this blog, we focus on the tokenizer, parser, and transformer:
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in