From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: final patch - plpgsql: for-in-array |
Date: | 2010-11-18 15:57:53 |
Message-ID: | AANLkTik=fV5g+b9aPKgFkq7v-2Jt2FFU-0TvJ4EkZMBZ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2010/11/18 Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>:
> 2010/11/18 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Thu, Nov 18, 2010 at 10:24 AM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>>> On Thu, Nov 18, 2010 at 12:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>>>>> On Wed, Nov 17, 2010 at 7:08 PM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
>>>>>> i will start the review of this one... but before that sorry for
>>>>>> suggesting this a bit later but about using UNNEST as part of the
>>>>>> sintax?
>>>>
>>>>> Does for-in-array do what unnset does?
>>>>
>>>> Yes, which begs the question of why bother at all. AFAICS this patch
>>>> simply allows you to replace
>>>>
>>>> for x in select unnest(array_value) loop
>>>>
>>>> with
>>>>
>>>> for x in unnest array_value loop
>>>>
>>>> (plus or minus a parenthesis or so). I do not think we need to add a
>>>> bunch of code and create even more syntactic ambiguity (FOR loops are
>>>> already on the hairy edge of unparsability) to save people from writing
>>>> "select".
>>>
>>> Pavel's performance argument is imnsho valid. arrays at present are
>>> the best way to pass data around functions and any optimizations here
>>> are very welcome. Given that, is there any way to mitigate your
>>> concerns on the syntax side?
>>
>> Can we get the performance benefit any other way? I hate to think
>> that it will still be slow for people using the already-supported
>> syntax.
>
> If you are able to make unnest() outputting 1st row without detoasting
> last field.
>
> I think if we have :
> #define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
> but for array, most is done
>
> Pavel, am I correct ?
yes, it can help, but still if you iterate over complete array, you
have to do n - detoast ops.
Pavel
>
>>
>> --
>> Robert Haas
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>
>
>
>
> --
> Cédric Villemain 2ndQuadrant
> http://2ndQuadrant.fr/ PostgreSQL : Expertise, Formation et Support
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2010-11-18 16:00:55 | Re: final patch - plpgsql: for-in-array |
Previous Message | Vaibhav Kaushal | 2010-11-18 15:56:06 | Re: Which data structures for the index? |