Re: Calculating statistic via function rather than with query is slowing my query

From: Anish Kejariwal <anishkej(at)gmail(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Calculating statistic via function rather than with query is slowing my query
Date: 2011-08-18 01:03:11
Message-ID: CAOpcnr-vYZgT+TMmv58rHCSzeDX9eu_+FmR16pUAkL-DxkrM4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thanks for the help Pavel and Craig. I really appreciate it. I'm going to
try a couple of these different options (write a c function, use a sql
function with case statements, and use plperl), so I can see which gives me
the realtime performance that I need, and works best for clean code in my
particular case.

thanks!

Anish

On Wed, Aug 17, 2011 at 5:05 PM, Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> wrote:

> 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
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2011-08-18 01:08:08 Re: Raid 5 vs Raid 10 Benchmarks Using bonnie++
Previous Message mark 2011-08-18 00:35:29 Re: Raid 5 vs Raid 10 Benchmarks Using bonnie++