Re: Optimizing query?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimizing query?
Date: 2013-01-31 14:09:00
Message-ID: CAFj8pRAdEwk1fnrCi+bU8dq5nGc8pDQ9tosD4-C3tff6dQ+dgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/1/31 Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>:
> Le jeudi 31 janvier 2013 à 11:06 +0100, Pavel Stehule a écrit :
>> 2013/1/31 Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>:
>> >
>> > Suppose I have a query of the form
>> >
>> > SELECT my_function(column_1), column_2
>> > FROM my_table
>> > GROUP BY my_function(column_1)
>> > ORDER BY my_function(column_1);
>> >
>> > where my_function is a user defined function.
>> >
>> > How many times is the function computed?
>>
>> if function is stable or immutable, then once per row
>>
>
> In this post (watch for line-wrap) :
>
> http://www.postgresql.org/message-id/CAFj8pRAdYL1-hCxH
> +QSZQKHt9YnoaOiGkfX4cNc9mzUTimcs1w(at)mail(dot)gmail(dot)com
>
> you wrote that it is usually better not to mark SQL functions (as
> opposed to plpgsql functions).
>
> So should I mark SQL functions stable/immutable if I use them in a query
> like the one above, or is it unnecessary?
>

It should not be marked

Regards

Pavel

>
> --
> Salutations, Vincent Veyron
> http://marica.fr/site/demonstration
> Logiciel de gestion des contentieux juridiques et des sinistres d'assurance
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2013-01-31 14:11:01 Re: Version numbers for binaries
Previous Message Vincent Veyron 2013-01-31 14:00:30 Re: Optimizing query?