Re: bad join performance

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: pginfo <pginfo(at)t1(dot)unisoftbg(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: bad join performance
Date: 2003-08-18 17:45:25
Message-ID: 20030818104119.C30675-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On Mon, 18 Aug 2003, pginfo wrote:

> Hi ,
> I am using pg 7.3.3 on RH 7.3,
> dual Athlon
> 1 GB RAM.
>
> I have 2 tables a_acc and a_vid_doc (all PK are int).
>
> sizes:
>
> select count(IDS) from a_acc;
> count
> ---------
> 1006772
>
> select count(IDS) from a_vid_doc;
> count
> -------
> 25
>
> I have problem with the join ot this tables.
> I tryed this examples:
>
> explain analyze select G.IDS from A_ACC G join A_VID_DOC VD
> ON(G.IDS_VID_DOC=VD.IDS) WHERE G.IDS = 1338673 ;

In general the best index on A_ACC for this kind of query might
be on on A_ACC(IDS, IDS_VID_DOC). That should allow you to search
by IDS value but still get a sorted order of IDS_VID_DOC to help
the join.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-08-18 18:40:21 Re: bad join performance
Previous Message Josh Berkus 2003-08-18 16:57:59 Re: Insert performance