On 2015-06-11 21:55, Cédric Krier wrote:
> 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).

I made some tests and indeed joins even on large table are not so
expensive if there is a where clause that reduces a lot the rows to join
on because pg can filter before doing the join.
So I made 'join' the default target_search method.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Reply via email to