compute_settings
Creates, updates, deletes, gets or lists a compute_settings resource.
Overview
| Name | compute_settings |
| Type | Resource |
| Id | netlify.database.compute_settings |
Fields
The following fields are returned by SELECT queries:
- get
| Name | Datatype | Description |
|---|---|---|
max_cu | number (double) | Maximum compute units |
min_cu | number (double) | Minimum compute units |
sleep_timeout_seconds | integer (int64) | Seconds of inactivity before suspension |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | site_id | Returns the project-level compute settings for the database. Returns effective settings (custom or tier defaults). Requires a Pro or higher plan. | |
set_for_branch | replace | site_id, branch_id | Sets compute settings for a specific database branch, overriding project-level settings. Requires a Pro or higher plan. | |
set | replace | site_id | Sets project-level compute settings for the database. Applied to new branches. Can be overridden per-branch. Requires a Pro or higher plan. | |
clear | delete | site_id | Resets 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.
| Name | Datatype | Description |
|---|---|---|
branch_id | string | The branch ID |
site_id | string |
SELECT examples
- get
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
- set_for_branch
- set
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;
Sets project-level compute settings for the database. Applied to new branches. Can be overridden per-branch. 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
RETURNING
max_cu,
min_cu,
sleep_timeout_seconds;
DELETE examples
- clear
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
;