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


Groups > comp.databases.postgresql > #432

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

From Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Newsgroups comp.databases.postgresql
Subject Re: Query slow in function but not in normal query window
Date 2013-01-14 22:10 +0100
Organization A noiseless patient Spider
Message-ID <m2r4lntqrv.fsf@2ndQuadrant.fr> (permalink)
References <5d79dd44-e7d2-4e65-9661-fb6dd337f610@googlegroups.com>

Show all headers | View raw


ivan.sammut@credorax.com writes:
>   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?

Try:

 - posting on the psql-general or pgsql-performance mailing list, see
   http://www.postgresql.org/list/ for details

 - using EXECUTE if the function is implemented using PLpgSQL

Regards,
-- 
Dimitri Fontaine
PostgreSQL DBA, Architecte

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


Thread

Query slow in function but not in normal query window ivan.sammut@credorax.com - 2013-01-14 03:39 -0800
  Re: Query slow in function but not in normal query window Dimitri Fontaine <dimitri@2ndQuadrant.fr> - 2013-01-14 22:10 +0100
  Re: Query slow in function but not in normal query window Ralf Döblitz <doeblitz@doeblitz.net> - 2013-01-14 18:15 +0000
  Re: Query slow in function but not in normal query window Jasen Betts <jasen@xnet.co.nz> - 2013-01-15 07:39 +0000

csiph-web