Flock's data team wrote up how they moved about 480 dbt models off AWS Glue and onto DuckDB, and cut their core build from 97 minutes to 25. The numbers are good. The line that stuck with me is the diagnosis: "Build time grew with the number of models, not the size of the data."
I hit the same wall from the query side, on a Trino lake over Iceberg. Different engine, different job, same wrong assumption. I thought a lake was slow because of the data. It was slow because of the tables.

Measured on my own lake: the same query through each catalog, a few runs each after a warm-up.
The cost you pay per object
In Flock's old setup, dbt sent every model to a hosted Spark session, one statement at a time, and checked for the answer once a second. A model of a dozen rows cost about 35 seconds. About 1 second of that was its actual SQL. Multiply that by 150-odd models in their core project and a build takes over an hour, however little data moves.
On my lake, Trino asked a remote catalog where each table lived, in every query, with no memory between queries. The catalog sat in one region and the engine in another, so each lookup cost about half a second. A question that touched 25 tables waited about 13 seconds before it read a single row.
Neither problem shows up when you test with one table. Both get worse every time someone adds a model or joins one more table.
Count round trips, not rows
The check is the same in both cases: find out how much time passes before any data is touched.
Flock's version was a 12-row model taking 35 seconds. In Trino, the query log tells you directly. Analysis is the step before any data is read:
SELECT query_id, analysis_time_ms, planning_time_ms, date_diff('millisecond', created, "end") AS total_ms FROM system.runtime.queries ORDER BY created DESC LIMIT 5; If analysis is a big slice of the total, and it grows with the number of tables in the query, the time is going to lookups, not data. A bigger cluster won't fix that.
Stop paying the per-object cost at run time
Flock kept their tables and their catalog. In their words, "the only thing that moved is where the SQL runs." DuckDB runs inside the dbt process itself, so there is no session to wait for and no round trip per statement. A small model now finishes in seconds.
I kept the engine and moved the lookup. I gave Trino a local address book: an Iceberg catalog in Postgres that holds each table's current metadata pointer. Analysis on the 25-table question went from about 13 seconds to 0.8. On a small question it went from 1.5 seconds to 0.17.
Two different fixes, one rule: if something is paid per table or per model, get it out of the path every query takes.
"Identical" is the hard part
The speedup is the easy half. Proving nothing changed is the real work.
Flock's list of quiet differences between Spark and DuckDB is the best part of their post. Arrays start at 1 instead of 0. concat skips NULLs instead of returning NULL. round() can land a penny out. Ascending sorts put NULLs last. Casting to an integer rounds instead of truncating. All of it is SQL that runs on both engines and quietly gives different answers. They compared every table between the old and new builds, in both directions, before anything was promoted.
My change was smaller, a pointer instead of an engine, but I held it to the same bar: the answers before and after had to be byte-for-byte identical. They were. If they hadn't been, the speedup wouldn't have counted.
The bill you take on
Neither fix is free.
Flock now owns their containers and their out-of-memory errors. About 15 of their 480 models needed a bigger container, and their table maintenance spend roughly doubled, because DuckDB writes merges as delete files that need compacting more often.
I now own a refresh job. Every time new data lands, the address book has to point at each table's newest metadata file, or Trino serves the previous version of the table: consistent, but stale. That is one remote call per table per refresh, instead of one per table per query. A good trade for a lake that is read far more than it is written, but still a job someone has to run. The full story of making that lake fast has the rest of the trade-offs.
Moving work out of the hot path doesn't delete it. It moves it somewhere you control.
Next time a lake feels slow, don't start with the row counts. Count the tables.



