> 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?


Reply via email to