Merge lp:~camptocamp/openobject-addons/trunk-fix_1311004_account_move_line_index-afe into lp:openobject-addons

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/trunk-fix_1311004_account_move_line_index-afe
Merge into: lp:openobject-addons
Diff against target: 13 lines (+3/-0)
1 file modified
account/account_move_line.py (+3/-0)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/trunk-fix_1311004_account_move_line_index-afe
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp (community) code review, no test Approve
Guewen Baconnier @ Camptocamp (community) code review Approve
OpenERP Core Team Pending
Review via email: mp+216689@code.launchpad.net

Description of the change

improve reading account_move_lines by using an index on date, id matching _order

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) :
review: Approve (code review, no test)

Unmerged revisions

9366. By Alexandre Fayolle - camptocamp on 2014-04-22

[IMP] add an index on account_move_line(date, id)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_move_line.py'
2--- account/account_move_line.py 2014-01-15 21:44:54 +0000
3+++ account/account_move_line.py 2014-04-22 12:11:15 +0000
4@@ -565,6 +565,9 @@
5 cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
6 if not cr.fetchone():
7 cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
8+ cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('account_move_line_date_id_index',))
9+ if not cr.fetchone():
10+ cr.execute('CREATE INDEX account_move_line_date_id_index ON account_move_line (date DESC, id desc)')
11 return res
12
13 def _check_no_view(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches

to all changes: