Hello!
I do not know how the SQL statement will look like and how postgresql will
optimize the search.
performance is critical and full table scans must be avoided
a statement like
select id from stock_move where (location_id = 12 and location_dest_id != 12)
or (location_id !=12 and location_dest_id =12);
would generate an optimized query plan
explain select id from stock_move where (location_id = 12 and location_dest_id
!= 12) or (location_id !=12 and location_dest_id =12);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on stock_move (cost=68.96..324.66 rows=2632 width=4)
Recheck Cond: ((location_id = 12) OR (location_dest_id = 12))
Filter: (((location_id = 12) AND (location_dest_id <> 12)) OR ((location_id
<> 12) AND (location_dest_id = 12)))
-> BitmapOr (cost=68.96..68.96 rows=3085 width=0)
-> Bitmap Index Scan on stock_move_location_id_index
(cost=0.00..55.68 rows=2590 width=0)
Index Cond: (location_id = 12)
-> Bitmap Index Scan on stock_move_location_dest_id_index
(cost=0.00..11.96 rows=495 width=0)
Index Cond: (location_dest_id = 12)
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578768-rha/+merge/122627
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-578768-rha.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp