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 index that might be causing problems in queries unrelated to to any of the ones it was designed to speed up. It's a new index, and the system as a whole seems slower since it was introduced. I just want to be able to reliably eliminate it as the culprit, and this seems like the easiest way, other solution suggestions, as well as better question suggestions, are also welcome.
You can also disable indexscan to disable all indices. Also, make sure you are doing explain analyze on your queries.
Click the plus sign to expand the table on which you want to disable an index. Click the plus sign to expand the Indexes folder. Right-click the index you want to disable and select Disable. In the Disable Indexes dialog box, verify that the correct index is in the Indexes to disable grid and click OK.
A normal DROP INDEX acquires an ACCESS EXCLUSIVE lock on the table, blocking other accesses until the index drop can be completed. With this option, the command instead waits until conflicting transactions have completed.
It's unfortunate that PostgreSQL can't currently temporarily index CTE terms. Other database products can do so, and it can be a huge performance win.
You can poke the system catalogue to disable an index:
update pg_index set indisvalid = false where indexrelid = 'test_pkey'::regclass
This means that the index won't be used for queries but will still be updated. It's one of the flags used for concurrent index building. Note that I've only done a quick test to see if the index still seems to be updated, caveat emptor.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With