Re: 4 way JOIN using aliases

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: KeithW(at)narrowpathinc(dot)com
Cc: "PostgreSQL Perform" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: 4 way JOIN using aliases
Date: 2005-04-11 01:41:05
Message-ID: 200504101841.05234.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Keith,

> Thanks to all on the NOVICE list that gave me help I now have a query
> running that returns the results I am after. :-)  Now of course I want it
> to run faster.  Currently it clocks in at ~160ms.  I have checked over the
> indexes and I belive that the tables are indexed properly.  The largest
> table, tbl_item, only has 2000 rows.  Is it possible to reduce the time of
> this query further?  

Probably not, no. For a 7-way join including 2 LEFT JOINs on the
unrestricted contents of all tables, 160ms is pretty darned good. If these
tables were large, you'd be looking at a much longer estimation time. The
only real way to speed it up would be to find a way to eliminate the left
joins. Also, PostgreSQL 8.0 might optimize this query a little better.

The only thing I can see to tweak is that the estimate on the number of rows
in tbl_item is wrong; probably you need to ANALYZE tbl_item. But I doubt
that will make a difference in execution time.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Neil Conway 2005-04-11 01:55:06 Re: 4 way JOIN using aliases
Previous Message Josh Berkus 2005-04-11 01:29:38 Re: Functionscan estimates