Forked from cirode/gist:9666edb6ef20d0bd1e891b4bcdc26b7a
Created
December 24, 2021 14:42
-
-
Save davidchua/8e3e85726d852fef86db41dad1cc70fb to your computer and use it in GitHub Desktop.
Disable indexes postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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