![]() ![]() Indexes that are not created for a constraint can be reindexed in the same way. Recreating Indexes with Foreign Key constraints These definitions can be used as is when we want to recreate them. You can also use a simple query to get the definition of all the indexes for a table.We add a table_name = 'my_sweet_table' to the WHERE clause at the end of the query to only get the indexes for our table, but that is completely optional. To figure out indexes that a table has and the corresponding bloat percentage for each of them, you can use this query (we picked it up from PgHero’s codebase).Remember to set statement_timeout = 0 before running the reindex command since CREATE INDEX commands are also taken as statements by Postgres, and they will be killed if they go above a decided threshold.You can read more about it in the official docs: Building Indexes Concurrently. Reindexing CONCURRENTLY is almost always a better option out. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |