cursors

From: "John Henderson" <jrh(at)is(dot)com(dot)fj>
To: <pgsql-general(at)hub(dot)org>
Subject: cursors
Date: 2000-01-17 04:58:08
Message-ID: 00ad01bf60a7$72e9e7c0$ea7c3eca@john.is.com.fj
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I am using postgres 6.4 on bsd/os3.0
The select that I want to use:
$select="select user_name,start,stop,nas_ip,port,
date_part('epoch',sess_time)
from $sessions_table s, userdir u
where user_name=username
and services in $in_phrase";
runs out of memory.
So I cleverly broke it down using cursors....
$result = $conn->exec("BEGIN");
$result = $conn->exec("declare cursor1 cursor for $select");
$result = $conn->exec("fetch 1000 from cursor1");

NOT SO CLEVER says the log
query: fetch 1000 from cursor1
ProcessUtility: fetch 1000 from cursor1
FATAL 1: palloc failure: memory exhausted
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)

Questions:
So, correct me if I'm wrong but it looks like cursors do not actually save
any memory and I have to use SELECT ... LIMIT ... OFFSET for this and to do
that I have to upgrade from postgresql6.4

Or is there another way?

And, it seems to me that there is a problem with pg_dump from 6.4 and reload
the data into 6.5.3 because of some sort of structural changes. Where is the
documentation that will safely take me from 6.4 to 6.5.3?

Thanks,
John

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Holger Klawitter 2000-01-17 08:46:39 Re: [GENERAL] Error connecting database
Previous Message Thomas Reinke 2000-01-17 04:57:11 Re: [GENERAL] cursors