Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
8200 Zobrazení

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)
Avatar
Zrušit

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 ...

Nejlepší odpověď

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.


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 15
7447
0
úno 25
563
2
led 25
6339
2
led 24
10137
7
led 24
47407