Merge lp:~hbrunn/ocb-addons/trunk_lp1237832 into lp:ocb-addons
Proposed by
Holger Brunn (Therp)
Status: | Merged |
---|---|
Merged at revision: | 9841 |
Proposed branch: | lp:~hbrunn/ocb-addons/trunk_lp1237832 |
Merge into: | lp:ocb-addons |
Diff against target: |
26 lines (+15/-1) 1 file modified
account_budget/account_budget.py (+15/-1) |
To merge this branch: | bzr merge lp:~hbrunn/ocb-addons/trunk_lp1237832 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Maxime Chambreuil (http://www.savoirfairelinux.com) | code review | Approve | |
Stefan Rijnhart (Opener) | test | Approve | |
Christophe CHAUVET | code review, no test | Approve | |
Review via email: mp+190317@code.launchpad.net |
Description of the change
Automatically derived from https:/
To post a comment you must log in.
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) analytic_ account analytic_ account. id analytic_ account analytic_ account_ hierarchy analytic_ account. parent_ id= account_ analytic_ account_ hierarchy. id) analytic_ line, recursive account_ analytic_ account_ hierarchy analytic_ account_ hierarchy. id
AS (select id
from account_
where id=%s
union all
select account_
from account_
join account_
on account_
SELECT SUM(amount)
FROM account_
WHERE account_id = recursive account_
...