Skip to main content

Improving dbt startup latency

The dbt command can take a while to start up because it needs to parse all of your model files before it can begin doing anything. However, you can reduce this startup latency by enabling partial parsing. With partial parsing enabled, dbt will cache and reuse unchanged files in between invocations, allowing it to start up faster.

To ensure that the necessary cache is available in your container, you can run the dbt ls command when building the Docker image. This command will list all resources in your project and populate the cache as a side effect.

To enable partial parsing, you should add the following line to your Dockerfile:

RUN dbt ls

Enabling partial parsing is especially useful for dbt projects with many models, as it can significantly reduce the startup time of your jobs.