From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Elielson Fontanezi <ElielsonF@prodam.sp.gov.br>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Query analyse
Date: Fri, 25 Jul 2003 08:49:15 -0700 (PDT)
Message-ID: <20030725084243.U31713-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <A799F7647794D311924A005004ACEA9709699779@cprodamibs249.prodam>
On Fri, 25 Jul 2003, Elielson Fontanezi wrote:
> First of all, my envoronment is:
> Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001
> i686 unknown
> pg_ctl (PostgreSQL) 7.2.1
>
> I would like some suggestions on how to speed up a query.
>
> Both of the queries below are identical except that one of them use the
> trunc function.
>
> You can see that the TRUNC function rise hardly up the query response
> time in the second query.
> That shouldn´t be happen. Only because a trunc function?
>
> What can I be in that case?
> What does it happen?
What does explain show for the two queries and what are the table schemas?
You're probably ending up with different plans since in one case it has
a plain column reference and in the other it has a marginally complicated
expression in the join condition.
As something to try, perhaps make a function that returns
trunc($1/100000.0)*100000 and index on that function for the column and
see if that changes the plan you get.
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-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, ElielsonF@prodam.sp.gov.br, pgsql-general@postgresql.org
Subject: Re: Query analyse
In-Reply-To: <20030725084243.U31713-100000@megazone.bigpanda.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