2009/5/19 Alvaro Herrera :
> Pavel Stehule escribió:
>
>> postgres=# create or replace function xx(anyarray, anyarray) returns
>> bool[] as $$
>> select array(select (select x = any(select y from unnest($2) g2(y)))
>> from unnest($1) g(x))
>> $$ language sql immutable;
>> CREATE FUNCTION
>
> There
Pavel Stehule escribió:
> postgres=# create or replace function xx(anyarray, anyarray) returns
> bool[] as $$
> select array(select (select x = any(select y from unnest($2) g2(y)))
> from unnest($1) g(x))
> $$ language sql immutable;
> CREATE FUNCTION
There ain't no unnest() function in 8.3 ...
Joshua Berry escribió:
> Please forgive the lack of grace. I'd love tips on how to improve this!
Tip: follow Pavel's suggestion.
--
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
--
Sent via pgs
you should use something similar to 'merge sort'
but only if your input is sorted (m_bx expects this)
In my case, order is not guaranteed, and as the result needs to match
the order of the input, it seems that using some exhaustive tail
recursive method is the way to go. (By that I mean a
2009/5/18 Joshua Berry :
> Hello All,
>
> I'm trying to optimize a few slow queries and helper functions, and have
> found a poor performing function. To improve performance, I'd like to create
> a function that does the following:
>
>
> Inputs:
> A: an array of integers. for example: { 1, 2, 3, 4,
hi,
you should use something similar to 'merge sort'
but only if your input is sorted (m_bx expects this)
if your subjects (numbers) are not going beyond a certain limit eg(65535)
take up an array and filter
you can generate a poly for array B's roots, and calculate A's points
-where it's 0,
Joshua Berry escribió:
> Inputs:
> A: an array of integers. for example: { 1, 2, 3, 4, 7 }
> B: an array of integers. for example: { 1, 4, 8, 9 }
>
> Returns
> C: an array of bools the same dimensions as Array A. In this example: {
> true, false, false, false, true, false }
>
> Effectively, this
Hello All,
I'm trying to optimize a few slow queries and helper functions, and
have found a poor performing function. To improve performance, I'd
like to create a function that does the following:
Inputs:
A: an array of integers. for example: { 1, 2, 3, 4, 7 }
B: an array of integers. for