Hello 1) increase statistics on res_partner_address.type (about 100)
alter table ... ALTER [ COLUMN ] column SET STATISTICS integer do analyze, and look again on plans. There are difference -> Seq Scan on res_partner_address a (cost=0.00..88.40 rows=16 width=552) (actual time=0.106..3.521 rows=559 loops=510) Filter: ((("type")::text = 'default'::text) OR ("type" IS NULL)) 2) I thing so index on res_partner.addr can help or use better column for identification (varchar isn't best) and partial index rep_partner_address.type is 'default' or resp_partner_address.type is null. Regards Pavel Stehule ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org