Re: killing processes

From: David Kerr <dmk(at)mr-paradox(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: killing processes
Date: 2009-07-21 15:45:09
Message-ID: 20090721154509.GB32606@mr-paradox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 20, 2009 at 11:14:22PM -0400, Tom Lane wrote:
- David Kerr <dmk(at)mr-paradox(dot)net> writes:
- > But, i don't see any coded loop or way for me to insert a signal check. (I'm not much of a
- > programmer) the function was just:
-
- > CREATE OR REPLACE FUNCTION array_median(anyarray)
- > RETURNS anyelement AS
- > $$
- > SELECT CASE
- > WHEN array_upper($1,1) = 0 THEN null
- > WHEN mod(array_upper($1,1),2) = 1 THEN
- > asorted[ceiling(array_upper(asorted,1)/2.0)]
- > ELSE
- > ((asorted[ceiling(array_upper(asorted,1)/2.0)] + asorted[ceiling(array_upper(asorted,1)/2.0)+1])/2.0) END
- > FROM (SELECT ARRAY(SELECT ($1)[n] FROM
- > generate_series(1, array_upper($1, 1)) AS n
- > WHERE ($1)[n] IS NOT NULL
- > ORDER BY ($1)[n]
- > ) As asorted) As foo ;
- > $$
- > LANGUAGE 'sql' IMMUTABLE;
-
- Huh. How big an array were you trying to invoke it on?
-
- regards, tom lane
-

there are 899991 records in the table it's just

test=# \d test2
Table "public.test2"
Column | Type | Modifiers
--------+--------------+-----------
t1 | numeric(9,4) |

Thanks

Dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Janning Vygen 2009-07-21 16:01:38 Re: suggestion: log_statement = sample
Previous Message Tom Lane 2009-07-21 15:42:07 Re: array_agg crash?