From: Anne Rosset <arosset@collab.net>
To: Jesper Krogh <jesper@krogh.cc>
Cc: pgsql-performance@postgresql.org
Subject: Re: Need to increase performance of a query
Date: Thu, 10 Jun 2010 11:36:08 -0700
Message-ID: <4C113098.5040105@collab.net> (raw)
In-Reply-To: <4C112B19.6080908@krogh.cc>
References: <4C1125F0.8090101@collab.net>
<4C112B19.6080908@krogh.cc>
Jesper Krogh wrote:
> On 2010-06-10 19:50, Anne Rosset wrote:
>> Any advice on how to make it run faster?
>
> What timing do you get if you run it with \t (timing on) and without
> explain analyze ?
>
> I would be surprised if you can get it much faster than what is is.. I
> may be that a
> significant portion is "planning cost" so if you run it a lot you
> might benefit from
> a prepared statement.
>
>
Hi Jesper,
Thanks your response:
psrdb=# \timing
Timing is on.
psrdb=# (SELECT
psrdb(# MAX(item_rank.rank) AS maxRank
psrdb(# FROM
psrdb(# item_rank item_rank
psrdb(# WHERE
psrdb(# item_rank.project_id='proj2783'
psrdb(# AND item_rank.pf_id IS NULL
psrdb(#
psrdb(# )
psrdb-# ORDER BY
psrdb-# maxRank DESC;
maxrank
-------------
20200000000
(1 row)
Time: 12.947 ms
It really seems to me that it should take less time.
Specially when I see the result with a different where clause like
this one:
psrdb=# SELECT
psrdb-# MAX(item_rank.rank) AS maxRank
psrdb-# FROM
psrdb-# item_rank item_rank
psrdb-# WHERE
psrdb-# item_rank.pf_id='plan1408'
psrdb-# ORDER BY
psrdb-# maxRank DESC;
maxrank
-------------
20504000000
(1 row)
Time: 2.582 ms
Thanks,
Anne
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: arosset@collab.net, jesper@krogh.cc
Subject: Re: Need to increase performance of a query
In-Reply-To: <4C113098.5040105@collab.net>
* 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