Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: unused database indexes

by
Leonardo Rochael Almeida
- 07/27/2016 10:59:57
Hi,

Resuscitating this old thread[1], I recently found this article that details very clearly why unused indexes are bad[2].



Notice that, despite the title of the article, I'm not advocating we consider MySQL.

But the article explains some details of the low level storage structure of Postgres and its implementation of MVCC that we should be aware of.

Basically, any write in any column of any record (even unindexed columns!) causes writes in ALL indexes pointing to that record.

In effect, any additional index on a PG table causes write amplification, so we should really make an effort to remove any unused or little used indexes.

And not add any index unless really needed.

Another point raised in the original thread was the fact that most CHAR field indexes are useless since most searches on these fields are through LIKE and ILIKE operators.

For these cases, we could be using trigram indexes:


Regards,

Leo