Is it possible to temporarily disable an index in Postgres?

后端 未结 3 1298
失恋的感觉
失恋的感觉 2021-01-30 03:57

I have got one index on a table that I would like to temporarily disable, I can\'t find any documentation suggesting that it\'s possible, though.

Reason: I\'ve got an in

3条回答
  •  囚心锁ツ
    2021-01-30 04:38

    begin;
    drop index foo_ndx;
    explain analyze select * from foo;
    rollback;
    

    I don't think there is a way to disable just one, though you can do this in a transaction to make recovering from it dead simple. You can also disable indexscan to disable all indices.

    Also, make sure you are doing explain analyze on your queries.

提交回复
热议问题