From 3b6a4cd0e2e7950d30c30e6d0a54d83d2ffc7db2 Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Mon, 27 Jan 2025 14:17:15 +0900 Subject: [PATCH] chore(docs): add new postgres-config delete command docs (#32982) * chore(docs): add new postgres-config delete command docs * chore: docs rephrase * chore: rewrite * chore: update common-cli-sections --- .../database/custom-postgres-config.mdx | 18 +++++++++++- apps/docs/spec/cli_v1_commands.yaml | 29 +++++++++++++++++++ apps/docs/spec/common-cli-sections.json | 6 ++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/apps/docs/content/guides/database/custom-postgres-config.mdx b/apps/docs/content/guides/database/custom-postgres-config.mdx index 914eb37fd66..b5137339fd2 100644 --- a/apps/docs/content/guides/database/custom-postgres-config.mdx +++ b/apps/docs/content/guides/database/custom-postgres-config.mdx @@ -151,6 +151,22 @@ postgres-config update --config max_parallel_workers=3 \ --replace-existing-overrides ``` +To delete specific configuration overrides, use the `postgres-config delete` command: + +```bash +supabase --experimental \ +--project-ref \ +postgres-config delete --config shared_buffers,work_mem +``` + +By default, this might restart the database after deleting the configurations. You can use the `--no-restart` flag to prevent the restart: + +```bash +supabase --experimental \ +--project-ref \ +postgres-config delete --config shared_buffers --no-restart +``` + ### Resetting to default config To reset a setting to its default value at the database level: @@ -171,6 +187,6 @@ alter role "" set "" to default; ### Considerations -1. Changes through the CLI must restart the database and will cause momentary disruption to existing database connections; in most cases this should not take more than a few seconds. However, you can use the --no-restart flag to bypass the restart and keep the connections intact. Keep in mind that this depends on the specific configuration changes you’re making. if the change requires a restart, using the --no-restart flag will prevent the restart but you won’t see those changes take effect until a restart is manually triggered. +1. Changes through the CLI might restart the database causing momentary disruption to existing database connections; in most cases this should not take more than a few seconds. However, you can use the --no-restart flag to bypass the restart and keep the connections intact. Keep in mind that this depends on the specific configuration changes you're making. if the change requires a restart, using the --no-restart flag will prevent the restart but you won't see those changes take effect until a restart is manually triggered. 1. Custom Postgres Config will always override the default optimizations generated by Supabase. When changing compute add-ons, you should also review and update your custom Postgres Config to ensure they remain compatible and effective with the updated compute. 1. Some parameters (e.g. `wal_keep_size`) can increase disk utilization, triggering disk expansion, which in turn can lead to [increases in your bill](/docs/guides/platform/compute-add-ons#disk-io). diff --git a/apps/docs/spec/cli_v1_commands.yaml b/apps/docs/spec/cli_v1_commands.yaml index 2c18228e206..5381236c3dc 100644 --- a/apps/docs/spec/cli_v1_commands.yaml +++ b/apps/docs/spec/cli_v1_commands.yaml @@ -1120,12 +1120,15 @@ commands: subcommands: - supabase-postgres-config-get - supabase-postgres-config-update + - supabase-postgres-config-delete flags: [] - id: supabase-postgres-config-update title: supabase postgres-config update summary: Update Postgres database config description: |- Overriding the default Postgres config could result in unstable database behavior. + If you experience instability after changing configurations, you can revert to the default values + using the 'postgres-config delete' command. Custom configuration also overrides the optimizations generated based on the compute add-ons in use. tags: [] links: [] @@ -1154,6 +1157,32 @@ commands: name: --project-ref description: Project ref of the Supabase project. default_value: '' + - id: supabase-postgres-config-delete + title: supabase postgres-config delete + summary: Delete Postgres database config overrides + description: Delete specific config overrides, reverting them to their default values. + tags: [] + links: [] + usage: supabase postgres-config delete [flags] + subcommands: [] + flags: + - id: config + name: --config + description: Config keys to delete (comma-separated) + default_value: '[]' + - id: no-restart + name: --no-restart + description: Do not restart the database after deleting config. + default_value: 'false' + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' + - id: project-ref + name: --project-ref + description: Project ref of the Supabase project. + default_value: '' - id: supabase-postgres-config-get title: supabase postgres-config get summary: Get the current Postgres database config overrides diff --git a/apps/docs/spec/common-cli-sections.json b/apps/docs/spec/common-cli-sections.json index 6e2aaff44be..351a0d9d4a0 100644 --- a/apps/docs/spec/common-cli-sections.json +++ b/apps/docs/spec/common-cli-sections.json @@ -840,6 +840,12 @@ "title": "Update Postgres configurations", "slug": "supabase-postgres-config-update", "type": "cli-command" + }, + { + "id": "supabase-postgres-config-delete", + "title": "Delete Postgres configurations", + "slug": "supabase-postgres-config-delete", + "type": "cli-command" } ] },