Re: join on three tables is slow

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gerry Reno" <greno(at)verizon(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: join on three tables is slow
Date: 2007-12-11 19:46:27
Message-ID: 162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2007-12-11 19:48:13 Re: Foreign Key for multi PK or design question
Previous Message Alvaro Herrera 2007-12-11 19:42:46 Re: Foreign Key for multi PK or design question