pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Anish Kejariwal <anishkej@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Calculating statistic via function rather than with query is slowing my query
Date: Thu, 18 Aug 2011 08:05:49 +0800
Message-ID: <4E4C575D.6080008@ringerc.id.au> (raw)
In-Reply-To: <CAOpcnr-1=YGsp=OAV58cdEfNw4EEuuzEqo53+9C7kURZLmX4Ew@mail.gmail.com>
References: <CAOpcnr9q2-q-n3TkuQFFgwc2UANFikZoFqhPwfmBJFu6b_MVrw@mail.gmail.com>
	<CAFj8pRDVTgF6RQwOEs1wJLHWy-FVO-mFGFRkZF70rmrxY8GTCQ@mail.gmail.com>
	<CAOpcnr-1=YGsp=OAV58cdEfNw4EEuuzEqo53+9C7kURZLmX4Ew@mail.gmail.com>

On 18/08/2011 3:00 AM, Anish Kejariwal wrote:
> Thanks Pavel! that definitely solved it.
>
> Unfortunately, the function I gave you was a simple/short version of 
> what the actual function is going to be.  The actual function is going 
> to get parameters passed to it, and based on the parameters will go 
> through some if...else conditions, and maybe even call another 
> function.  Based on that, I was definitely hoping to use plpgsql, and 
> the overhead is unfortunate.
>
> Is there any way to get around this overhead?  Will I still have the 
> same overhead if I use plperl, plpython, pljava, or write the function 
> in C?

You can probably still write it as an SQL function if you use CASE WHEN 
appropriately.

--
Craig Ringer

view thread (8+ messages)  latest in thread

Message-ID: <4E4C575D.6080008@ringerc.id.au>
Permalink:  ../4E4C575D.6080008@ringerc.id.au/
Also on:    postgresql.org/message-id/4E4C575D.6080008@ringerc.id.au

 · 

reply

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: ringerc@ringerc.id.au, anishkej@gmail.com, pavel.stehule@gmail.com
  Subject: Re: Calculating statistic via function rather than with query is slowing my query
  In-Reply-To: <4E4C575D.6080008@ringerc.id.au>

* 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