From: Scott Marlowe <scott.marlowe@gmail.com>
To: Adonias Malosso <malosso@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: 4s query want to run faster
Date: Thu, 21 Feb 2008 14:58:04 -0600
Message-ID: <dcc563d10802211258w65285c0bl9f9da18b9ed0fa92@mail.gmail.com> (raw)
In-Reply-To: <8a5d3c890802211248k7d9dfbb5ndd645358a84130a7@mail.gmail.com>
References: <8a5d3c890802211248k7d9dfbb5ndd645358a84130a7@mail.gmail.com>
On Thu, Feb 21, 2008 at 2:48 PM, Adonias Malosso <malosso@gmail.com> wrote:
> Hi all,
>
> The following query takes about 4s to run in a 16GB ram server. Any ideas
> why it doesn´t use index for the primary keys in the join conditions?
>
> select i.inuid, count(*) as total
> from cte.instrumentounidade i
> inner join cte.pontuacao p on p.inuid = i.inuid
> inner join cte.acaoindicador ai on ai.ptoid = p.ptoid
> inner join cte.subacaoindicador si on si.aciid = ai.aciid
> where i.itrid = 2 and p.ptostatus = 'A'
> group by i.inuid
> having count(*) > 0
What does explain analyze say about that query?
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: scott.marlowe@gmail.com, malosso@gmail.com
Subject: Re: 4s query want to run faster
In-Reply-To: <dcc563d10802211258w65285c0bl9f9da18b9ed0fa92@mail.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