Re: Converting each item in array to a query result row

From: Osvaldo Kussama <osvaldo(dot)kussama(at)gmail(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: Adam Ruth <adamruth(at)mac(dot)com>, Postgres User <postgres(dot)developer(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting each item in array to a query result row
Date: 2009-05-29 14:08:08
Message-ID: 690707f60905290708m3f3c90f4l5c4905a215f5462e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/5/29 Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>:
> 2009/5/29 Adam Ruth <adamruth(at)mac(dot)com>:
>> Always test your performance assumptions. The plpgsql function is faster
>> than the sql function, a lot faster on smaller arrays.
>>
>> unnest - 10 element array - 100,000 times: 6701.746 ms
>> unnest - 100 element array - 100,000 times: 11847.933 ms
>> unnest - 1000 element array - 100,000 times: 59472.691 ms
>>
>> explode - 10 element array - 100,000 times: 1941.942 ms
>> explode - 100 element array - 100,000 times: 8521.289 ms
>> explode - 1000 element array - 100,000 times: 44980.048 ms
>>
>

Version 8.4 has an internal function unnest(anyarray):
http://developer.postgresql.org/pgdocs/postgres/functions-array.html

Osvaldo

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-05-29 14:44:57 Re: Converting each item in array to a query result row
Previous Message Martin Gainty 2009-05-29 13:52:15 Re: Configure server firewall request/response