On 2015-06-11 21:37, Jordi Esteve wrote: > On 11/06/15 21:10, Cédric Krier wrote: > >>By the way, the default option in the new parameter 'target_search' for m2o > >>fields is 'subquery'. Maybe is it better to set 'join' by default? If not, > >>then the m2o relations suspected to have a lot of records like move lines, > >>invoice lines, sale lines, stock moves, ... should have the 'join' parameter > >>set in the tryton modules? > >I will explain why I kept 'subquery' as default. On small database, > >there will be almost no difference with the 'join'. On larger database, > >in many cases the query planner could infer the 'join' if it worths it > >base on its statistics. But the 'in' join could be worse on specific > >case. > > If on small database there is almost no difference between the two methods > and on larger databases the 'in' joint is worse, I don't see the advantage > to keep the 'subquery' method as the default one. > > I make the question in another way: Which are the advantages of using > 'subquery' method instead of 'join' method?
They are faster if the target table is small. And I bet that we have more small table than big one because small table are the referential while big table are the operational and I think we have much more referential Model than operational (we try to reuse the operational). > >So for me, we must explicitly set the 'target_search' after some > >thoughts just like the 'ondelete'. We will have to make an issue after > >this one to search on each module the Many2One to fix. > Ok, but we must have a good criteria to choose one of the two methods in > each case. Yes for me, if the target is a table that is growing overtime then 'join' must be used otherwise 'subquery'. -- Cédric Krier - B2CK SPRL Email/Jabber: [email protected] Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
