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

We are going to add some indexes to certain fields (Odoo 10). But I'm not 100% sure that this is the best approach. So currently I'm inheriting for example sale.order.line to add an index to product_id.  Any side effect to this? If I uninstall the module it will not remove the field (that's good) but the index will stay. 

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

product_id = fields.Many2one('product.product', string='Product', domain=[('sale_ok', '=', True)], change_default=True, ondelete='restrict', required=True, index=True)
아바타
취소

I would love to know the answer to this question. I, too, am considering adding an index to a core field.

nobody answered until now on this ? I don't understand why Odoo didn't add indexes on a lot of ID fields as well, so I want to do this at least for a couple of them ...

베스트 답변

database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. Indexes are used to quickly locate data without having to search every row in a database table every time said table is accessed. Indexes can be created using one or more columns of a database table, providing the basis for both rapid random lookups and efficient access of ordered records.


Indexes are a common way to enhance database performance. An index allows the database server to find and retrieve specific rows much faster than it could do without an index. But indexes also add overhead to the database system as a whole, so they should be used sensibly.


아바타
취소
관련 게시물 답글 화면 활동
1
3월 15
7448
0
2월 25
566
2
1월 25
6345
2
1월 24
10137
7
1월 24
47408