Skip to content

Instantly share code, notes, and snippets.

@cirode
Created September 11, 2018 01:42
Show Gist options
  • Save cirode/9666edb6ef20d0bd1e891b4bcdc26b7a to your computer and use it in GitHub Desktop.
Save cirode/9666edb6ef20d0bd1e891b4bcdc26b7a to your computer and use it in GitHub Desktop.
Disable indexes postgres
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='<TABLE_NAME>'
);
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='<TABLE_NAME>'
);
REINDEX <TABLE_NAME>;
-- https://fle.github.io/temporarily-disable-all-indexes-of-a-postgresql-table.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment