Re: Help understanding indexes, explain, and optimizing

From: "i(dot)v(dot)r(dot)" <ivanvega(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Help understanding indexes, explain, and optimizing
Date: 2006-03-07 02:11:47
Message-ID: 440CEBE3.6030004@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Chris escribió:
> Have you done an 'analyze' or 'vacuum analyze' over these tables?
>
> A left outer join gets *everything* from the second table:
>
> > LEFT OUTER JOIN groups ON groups.id = locations.group_id
> > LEFT OUTER JOIN schools ON schools.location_id = locations.id
>
> So they will load everything from groups and schools. Maybe they
> should be left join's not left outer joins?
>
>
Yes, I did that. I tried your other suggestion and it did improve it by
about 200ms.

I also repurposed the query by selecting first from the groups table and
joining with the locations and schools tables, and that made all the
difference. Now it's down to
32ms. Yipee!

Thanks!

Ivan V.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Fuhr 2006-03-07 03:22:09 Re: Can anyone explain this pgbench results?
Previous Message Chris 2006-03-07 00:40:19 Re: Help understanding indexes, explain, and optimizing