Skip to main content

compute_settings

Creates, updates, deletes, gets or lists a compute_settings resource.

Overview

Namecompute_settings
TypeResource
Idnetlify.database.compute_settings

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
max_cunumber (double)Maximum compute units
min_cunumber (double)Minimum compute units
sleep_timeout_secondsinteger (int64)Seconds of inactivity before suspension

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsite_idReturns the project-level compute settings for the database. Returns effective settings (custom or tier defaults). Requires a Pro or higher plan.
set_for_branchreplacesite_id, branch_idSets compute settings for a specific database branch, overriding project-level settings. Requires a Pro or higher plan.
setreplacesite_idSets project-level compute settings for the database. Applied to new branches. Can be overridden per-branch. Requires a Pro or higher plan.
cleardeletesite_idResets project-level compute settings to tier defaults. Requires a Pro or higher plan.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
branch_idstringThe branch ID
site_idstring

SELECT examples

Returns the project-level compute settings for the database. Returns effective settings (custom or tier defaults). Requires a Pro or higher plan.

SELECT
max_cu,
min_cu,
sleep_timeout_seconds
FROM netlify.database.compute_settings
WHERE site_id = '{{ site_id }}' -- required
;

REPLACE examples

Sets compute settings for a specific database branch, overriding project-level settings. Requires a Pro or higher plan.

REPLACE netlify.database.compute_settings
SET
min_cu = {{ min_cu }},
max_cu = {{ max_cu }},
sleep_timeout_seconds = {{ sleep_timeout_seconds }}
WHERE
site_id = '{{ site_id }}' --required
AND branch_id = '{{ branch_id }}' --required
RETURNING
max_cu,
min_cu,
sleep_timeout_seconds;

DELETE examples

Resets project-level compute settings to tier defaults. Requires a Pro or higher plan.

DELETE FROM netlify.database.compute_settings
WHERE site_id = '{{ site_id }}' --required
;