On 17/05/05, rgilaard / few.vu.nl <rgilaard / few.vu.nl> wrote:
> Dear all,
> I'm using a ruby script to manipulate some database tables in postgresql 7.4.6
> running under freebsd.
> 
> The following query
> 
> create table as select ident,count(ident) as totnrchange from bookhistory group
> by ident
> 
> Takes almost 20 minutes to accomplish if I issue these commands from the psql
> client utility.
> 
> However, if I use ruby to do the same as in:
> 
> Res=conn.exec("create table as select ident,count(ident) as totnrchange from
> bookhistory group by ident")
> 
> I get the follwing error:
> 
> Maketestset.rb : 47: IN 'exec': could not receive data from server: Operation
> timed out (PGError) from maketestset.rb
> 
> I also notice when looking at the outcome of top, that the % the cpu is busy
> with the postgers process gradually decreases and after a certain time the cpu
> stops doing anything and I get this error message.
> 
> What could cause this? I'm suspecting ruby because when I normally do this in
> psql, the query finishes.
> I have to do it like this because this statement is in a for loop and gets
> repeated almost 300 times

Just curious, does that mean that you wait > 4 Days creating the table
300 times? Thats a lot of time. Would you care to tell me how many
rows are in this table?

best regards,

Brian

> 
> Can anyone help with this one?
> Thanks in advance
> Robert
> 
> 



-- 
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/