Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #433

Re: Query slow in function but not in normal query window

From Ralf Döblitz <doeblitz@doeblitz.net>
Newsgroups comp.databases.postgresql
Subject Re: Query slow in function but not in normal query window
Date 2013-01-14 18:15 +0000
Organization private site in Braunschweig, Germany
Message-ID <kd1hvf$50m$2@selene.doeblitz.net> (permalink)
References <5d79dd44-e7d2-4e65-9661-fb6dd337f610@googlegroups.com>

Show all headers | View raw


ivan.sammut@credorax.com wrote:
> Hi ppl,
> 
>  I have a function which returns a number of transactions which fall between 2 dates and when I run this in a normal query window it is quite fast (40 secs maximum). But when I put the same query in a function and the dates are passed to the query as parameters the function will take more than 4 minutes as if the query is not using an indexing. 
> 
> Anyone had the same problem or has any idea?

Maybe the optimizer could not utilize an index. Try to compare the plans
for both queries (with and without parameters for the dates).

Ralf
-- 
"de.alt.comp.kde Die Kommunistische Desktop Erweiterung."
                  – Sven Paulus in <67hu21$43r$1@imperator.oops.sub.de>

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

#431 
  #432 
  #433 
  #434 

csiph-web