Tanalis has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently using Sybase::BCP to upload a set of rows to a database. I need to do this more than once, and hence I've written the following sub to allow me to do this easily:
sub bcpInsert { my ($table, $_rows) = @_; # configure BCP for the push BCP_SETL(TRUE); my $bcp = new Sybase::BCP $user, $pass, $server; $bcp -> bcp_init($table, "", "", DB_IN); $bcp -> bcp_meminit((1 + $#{@$_rows[0]})); # perform the db upload my $count; foreach my $row (@$_rows) { $bcp -> bcp_sendrow($row); $bcp -> bcp_batch unless (++$count % 100); # commit every 100 r +ows } $bcp -> bcp_batch; # commit the last batch of data $bcp -> bcp_done; warn "Debugging: bcpInsert returning ..\n"; }
Now, this uploads data to the tables perfectly, and I'm happy with that portion of the script. However, as the sub returns, the system slows down to almost a halt, and top reports iowait tending to 100%.
I've tried outputting a line of text immediately following this sub, and it can take up to 5 minutes for this line to print following the return of the sub.
I'm calling the sub as follows:
# build an array of arrays for BCP to upload &bcpInsert("custdata", \@data); print "Upload complete\n";
Any suggestions about how to get round this problem would be appreciated.
Thanks ..
-- Foxcub
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sybase::BCP & iowait
by robartes (Priest) on Nov 12, 2002 at 14:55 UTC | |
by Tanalis (Curate) on Nov 12, 2002 at 15:08 UTC | |
|
Re: Sybase::BCP & iowait
by mpeppler (Vicar) on Nov 12, 2002 at 16:24 UTC | |
|
Re: Sybase::BCP & iowait
by fglock (Vicar) on Nov 12, 2002 at 14:56 UTC | |
by Tanalis (Curate) on Nov 12, 2002 at 15:21 UTC | |
|
Re: Sybase::BCP & iowait
by mpeppler (Vicar) on Nov 12, 2002 at 16:05 UTC | |
by Tanalis (Curate) on Nov 12, 2002 at 16:11 UTC | |
by mpeppler (Vicar) on Nov 12, 2002 at 16:31 UTC | |
|
Re: Sybase::BCP & iowait
by krisahoch (Deacon) on Nov 12, 2002 at 15:31 UTC |