From: i.v.r. <ivanvega@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Help understanding indexes, explain, and optimizing
Date: Mon, 06 Mar 2006 20:11:47 -0600
Message-ID: <440CEBE3.6030004@gmail.com> (raw)
In-Reply-To: <440CD673.8080208@gmail.com>
References: <440CD0BB.2020800@gmail.com>
<440CD673.8080208@gmail.com>
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.
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-performance@postgresql.org
Cc: ivanvega@gmail.com
Subject: Re: Help understanding indexes, explain, and optimizing
In-Reply-To: <440CEBE3.6030004@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