Re: Query analyse - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Query analyse
Date
Msg-id 20030725084243.U31713-100000@megazone.bigpanda.com
Whole thread Raw
In response to Query analyse  (Elielson Fontanezi <ElielsonF@prodam.sp.gov.br>)
Responses Re: Query analyse  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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.




pgsql-general by date:

Previous
From: "Cory 'G' Watson"
Date:
Subject: Re: Solaris, Postgresql and Problems
Next
From: Dmitry Tkach
Date:
Subject: Re: Query analyse