MotherDuck:
DuckDB in the cloud & in the client
NWDS 2024
Jordan Tigani
co-founder & chief duck-herder @MotherDuck
2024-02-09
Remembrance of NWDS Meetings Past
NWDS 2022
What is DuckDB?
�A lightweight, in-process SQL Analytics Engine that is taking the data world by storm.
Embedded Database Execution w/ DuckDB
Client / Server Database Execution
DuckDB Execution
driver
results!
Database
Server
Application
SQL
data
DuckDB
results!
Application
SQL
data
API
What is MotherDuck?
�A serverless DuckDB platform for low-cost, low-friction analytics that will scale to support complex apps and data
MotherDuck Architecture
MotherDuck Architecture
Client Extension Server Extension
What do the Extensions do?
remote
(duckling)
MotherDuck
Server
Extension
local
(client)
MotherDuck
Client
Extension
DuckDB
Par
se
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
Bind
DuckDB
Parse
Bind
Optimize
Execute
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
Bind
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM parquet_scan(“/home/tab.parquet”) t SELECT sum(t.c)
“recognize tables &
where they
come from”
Bind
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM parquet_scan(“s3://tab.parquet”) t SELECT sum(t.c)
Bind
“recognize tables &
where they
come from”
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM local_db.tab t SELECT sum(t.c)
Bind
“recognize tables &
where they
come from”
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM remote_db.tab t SELECT sum(t.c)
Bind
“recognize tables &
where they
come from”
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM remote_db.tab t SELECT sum(t.c)
Virtual catalog (skip network hop)
Bind
“recognize tables &
where they
come from”
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
FROM range(1,100000000) LIMIT 100
“location agnostic” data source
Bind
“recognize tables &
where they
come from”
Query Pipelines
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
Query Pipelines
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
Query Pipelines
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
“decide which pipeline to run where”
Bind
Local-Remote Planning
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
Local-Remote Planning
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
local
remote
agnostic
Local-Remote Planning
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
Bridge Operators
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
SELECT count(*) FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t3.b = t2.b
aggregate
join
join
scan(t1)
scan(t2)
scan(t3)
bridge operator
What do the Extensions do?
local (client)
remote (duckling)
Extension
DuckDB
Parse
Bind
Optimize
Execute
Bind
Optimize
Execute
Execute
results
Parse
“bridge operators transport data in flow”
Bind
DEMO TIME!
Exploring Hybrid Topologies
Future Work
Parallel Scans
Note similarity to Aggregators & leaves in CDW
Server
Client
Query Engine
Object Store
Query Engine
Server
Query Engine
Server
Query Engine
Edge Cache
Cache can be recent data, sampled data, or region-fenced data
Server
Server
Query Engine
Query Engine
Client
Query Engine
Local Region / PoP
Central Region
Object Store
Cache
Cross-Region Joins
Server
Server
Query Engine
Object Store
Query Engine
Server
Query Engine
Client
Query Engine
Region 2
Region 1
Object Store
Reverse the polarity
“Find Security Threats”�Minimize Egress
Client
Query Engine
Local DB
Client
Query Engine
Local DB
Client
Query Engine
Local DB
Server
Query Engine
Admin
Query Engine
Thank you!