News for hackers. Stuff that matters.
Re:Features I'd Like in PostgreSQL by valzam on Saturday January 28, 2023 @04:27PM (#34562109)
I hope postgres adopts easily disabling an index instead of deleting it. MySQL has this feature and it's very useful for testing whether an index can be deleted on production load. Transactional DDL is amazing already, disabling indexes would be a great addition for low-risk performance tuning.
Re:Features I'd Like in PostgreSQL by pramsey on Saturday January 28, 2023 @06:00PM (#34562916)
update pg_index set indisvalid = false where indexrelid = 63514;
Re:Features I'd Like in PostgreSQL by ioltas on Saturday January 28, 2023 @07:38PM (#34563618)
It's been argued a few times that we should have the possibility to make an index invalid on sight with a proper ALTER INDEX command, yes.
Re:Features I'd Like in PostgreSQL by samokhvalov on Saturday January 28, 2023 @09:30PM (#34564287)
I see to use cases:

- disable for all - disable only for my session, to check what would happen with the plan, and only then decide to proceed with disabling for all (or to drop it)

ALTER is quite invasive way, even more than "UPDATE .. SET indisvalid = false ...". It would be good to do it via SET as it was proposed in the plantuner extension long ago.

Re:Features I'd Like in PostgreSQL by samokhvalov on Saturday January 28, 2023 @09:29PM (#34564274)
There is an opinion that it's unsafe: https://twitter.com/petervgeoghegan/status/15991919640456724...

There was an extension from Teodor some time ago, plantuner, to disable indexes in a session or globally ("set plantuner.forbid_index='id_idx2';") – but it didn't make it to core, and even to contribs. Maybe because the functionality to disable indexes was mixed with planner hints there. It's a very old story, discussion from 2009: https://www.postgresql.org/message-id/flat/47E63672-972E-452...

Re:Features I'd Like in PostgreSQL by viraptor on Saturday January 28, 2023 @06:19PM (#34563040)
The completely unused indexes can be found through https://www.postgresql.org/docs/current/monitoring-stats.htm...
Re:Features I'd Like in PostgreSQL by haki on Sunday January 29, 2023 @11:27PM (#34575771)
You can utilize transactional DDL for that

https://hakibenita.com/sql-tricks-application-dba#make-index...