콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3920 화면

I'm wondering what is faster or is there no difference between

for rec in self:
    partner = rec.env['res.partner'].search() # or any other orm method

OR

partner_env = self.env['res.partner']
for rec in self:
    partner = partner_env.search() # or any other orm method

I'm creating a sync with Odoo from other older custom CRM/ERPs and the sync has to go trough 100+, 1000+ or even 10000+ records. So every small performance boost helps.

So what method is faster and why?


아바타
취소
베스트 답변

Hi Samo:

The 2nd option (using a variable) will be marginally faster because the recordset is built once and reused inside the loop.

아바타
취소
작성자

thanks! thought so.

관련 게시물 답글 화면 활동
0
2월 19
5225
2
12월 23
14930
0
10월 23
33
3
10월 23
790
1
10월 23
569