← Back to team overview

openerp-expert-framework team mailing list archive

Re: Database indexes for foreign keys

 

Alexandre,

Actually, we did the same analysis some time ago when looking for
easy-wins on our project, and I've added a small script which is
called after each OpenERP refresh ( >>> client.upgrade("base") ) to
check if some index is missing.
We've seen big improvements on database usage, especially when
deleting entries in heavy tables having foreign keys.

https://gist.github.com/florentx/10875212


-- 
Florent

2014-04-16 15:23 GMT+02:00 Alexandre Fayolle <alexandre.fayolle@xxxxxxxxxxxxxx>:
> Hello,
>
> I came across this while analyzing pg logs with pgbadger : postgreSQL
> does not automatically create indexes for foreign key columns, and I was
> surprised when I noticed that the ORM in OpenERP does not do this by
> default. Has anyone been doing some analysis on this and concluded that
> manual creation of such indexes was the correct thing to do because the
> read-time gains were nullified by the write-time costs ?
>
> My gut feeling is that in most cases we want such index to be created,
> and that select should default to True for m2o fields (and then we could
> always explicitely disable index creation for the few fields for which
> this would cause harm).
>
> --
> Alexandre Fayolle
> Chef de Projet
> Tel : + 33 (0)4 79 26 57 94
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac Cedex
> http://www.camptocamp.com
> F
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-expert-framework
> Post to     : openerp-expert-framework@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-expert-framework
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References