pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Gerry Reno <greno@verizon.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: join on three tables is slow
Date: Tue, 11 Dec 2007 20:46:27 +0100
Message-ID: <162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com> (raw)
In-Reply-To: <475ED469.5080906@verizon.net>
References: <475C96EA.6090002@verizon.net>
	<475CC478.7010102@Sheeky.Biz>
	<475E111B.6060203@verizon.net>
	<162867790712102200m2144573bw7447e0eff6720d55@mail.gmail.com>
	<475E8F6A.4030004@verizon.net>
	<162867790712110655o2cf99bf1n9acf6b440d726440@mail.gmail.com>
	<475ED469.5080906@verizon.net>

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



view thread (11+ messages)  latest in thread

Message-ID: <162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com>
Permalink:  ../162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com/
Also on:    postgresql.org/message-id/162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pavel.stehule@gmail.com, greno@verizon.net
  Subject: Re: join on three tables is slow
  In-Reply-To: <162867790712111146x35f547c0pc01fcf1aa167e0e5@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox