← Back to team overview

openerp-community-reviewer team mailing list archive

Re: [Merge] lp:~hbrunn/ocb-addons/trunk_lp1237832 into lp:ocb-addons

 

Review: Approve code review, no test

Hi

After review the query, it's better to remove the IN operator and use the natural join with the recursive query (Explain plan is better)

It's ok for me.

See a better like this

WITH RECURSIVE account_analytic_account_hierarchy(id)
AS (select id 
      from account_analytic_account
     where id=%s
    union all
    select account_analytic_account.id 
      from account_analytic_account
      join account_analytic_account_hierarchy
        on account_analytic_account.parent_id= account_analytic_account_hierarchy.id)
SELECT SUM(amount) 
FROM account_analytic_line, recursive account_analytic_account_hierarchy 
WHERE account_id = recursive account_analytic_account_hierarchy.id 
...
-- 
https://code.launchpad.net/~hbrunn/ocb-addons/trunk_lp1237832/+merge/190317
Your team OpenERP Community Backports Team is subscribed to branch lp:ocb-addons.


References