The Gatsby Drupal module has a submodule called Gatsby Fastbuilds that speeds up build times by only downloading content that has changed since the last build.
You can read more about how to configure Fastbuilds in the submodule readme.
How it works
Fastbuilds works by logging entity changes on your Drupal site and allows Gatsby to pull only content that has changed since the last sync.
When Fastbuilds is enabled, Gatsby will save a timestamp at the end of a full build in the cache. On the next full build, gatsby-source-drupal will send that timestamp to Drupal and ask Drupal to send only the content that has changed since the timestamp.
Fastbuilds only works during full builds:
- running gatsby develop locally or in a cloud environment
- running gatsby build locally or in a cloud environment
- on full builds in Gatsby Cloud (when manually triggering a build or builds for code changes)
Fastbuilds does not save a timestamp during a Cloud Build. For more info on Cloud builds, see Gatsby Builds: Full, Incremental, and Cloud.
Fastbuilds and Cloud Builds together
You don't have to use Fastbuilds to get the benefits of incremental content changes with Gatsby Cloud, but you can use Fastbuilds and Cloud Builds together to speed up builds that are triggered manually and builds created based on PR merges.
To do this, follow the configuration instructions of the Fastbuilds module.
The key consideration for using Fastbuilds and Cloud Builds together is how often you expect there to be code changes to your production site, which will influence how you decide how long to keep Fastbuild log entries in your Drupal logs. This is configurable within the Fastbuilds module in Drupal.
Here's an example. If you decide to only keep Fastbuilds logs for 7 days, and there are only content changes (ie Cloud Builds) on your site in that time period, the next code change or manually triggered build will not be a Fastbuild because the logs will have expired.