Why would this crash my server

Поиск
Список
Период
Сортировка
От glenn
Тема Why would this crash my server
Дата
Msg-id 1046052378.3417.25.camel@thor.valhalla
обсуждение исходный текст
Ответы Re: Why would this crash my server  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi all
I've been playing round for a week or so now trying to master the
elusive secrets of passing sets of records around in postgres. Having
made a little progress, I thought I'd try using cursors - I didn't get
very far, but I did bring my machine to its knees and kill the postgres
server (on the same machine). Here's what I did, I'm wondering what
needs changing:

-- Here is my table
glenn=# select * from zz;
 a | b
---+---
 1 | 0
 2 | 0
 3 | 0
 4 | 2
 5 | 2
 6 | 1
 7 | 4
 8 | 4
 9 | 7
(9 rows)

-- Here is my experimental function
create or replace function zz_dump() returns setof zz  as '
declare
        thiscur  refcursor;
        zz_tmp zz%rowtype ;
begin
        open thiscur for select a, b from zz;
        fetch thiscur into zz_tmp  ;
        return zz_tmp;
end;' language 'plpgsql';

--Heres the result, which comes after 5 min of hdd light thrashing,
capslock light doesn't respond and gui completely freezes. Interesting
thing is that after this executes, the gnome resources panel shows that
the amount of physical memory in use has halved. i.e. first time
95%->47%, 2nd time 47%->21%

thanks for _any_ help
Glenn


В списке pgsql-novice по дате отправления:

Предыдущее
От: Robert Prather
Дата:
Сообщение: Re: User Problem In PostgreSQL on Mac OS X
Следующее
От: Michael Weaver
Дата:
Сообщение: Substring & escape Character