Skip to content

Instantly share code, notes, and snippets.

@jonashaag
Last active September 2, 2022 07:34
Show Gist options
  • Save jonashaag/54a1cf6c5c5f6bd7f4c87c9ad8260db1 to your computer and use it in GitHub Desktop.
Save jonashaag/54a1cf6c5c5f6bd7f4c87c9ad8260db1 to your computer and use it in GitHub Desktop.
PostgreSQL temporarily disable index
UPDATE pg_index
SET indisready=false, indisvalid=false
WHERE indrelid = (SELECT oid FROM pg_class WHERE relname='<TABLE_NAME>');
... do work ...
REINDEX TABLE "<TABLE_NAME>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment