Re: DBI, postgresql and large table



On 6/27/07, Andrej Kastrin <andrej.kastrin@xxxxxxxx> wrote:
Dear all,

I need to process postgresql table with DBI module. The script below
works well for small tables, but when I want to process larger tables
(100000 rows) out-of-memory occurs.

Any suggestion? Thanks in advance,
Andrej

use strict;
use warnings;
use DBI;

my $dbh = DBI->connect("DBI:Pg:dbname=medline;host=localhost",
"postgres", "secret", {'RaiseError' => 1});
my $sth = $dbh->prepare("SELECT text_a, text_b FROM tmp_table");
$sth->execute();

while (my $ref = $sth->fetchrow_hashref()) {
my $field_a = $ref->{'text_a'};
my $field_b = $ref->{'text_b'};
print "$field_a \t $field_b\n";
}

* When does it fail and what is the exact error message?
* Have you tried to execute this command in an SQL editor (psql if I
remember correctly)?
* How much memory do you have on that box?
.



Relevant Pages

  • DBI, postgresql and large table
    ... I need to process postgresql table with DBI module. ... The script below works well for small tables, but when I want to process larger tables out-of-memory occurs. ... use warnings; ...
    (perl.beginners)
  • Data type mismatch warning using DBI
    ... I am using Perl 5.8 with the DBI module to routinely send parsed data to an ... Sometimes the incoming files may have errors so that numeric data appears as ... When this happens the script contiues to run and on looking at the db the ... I can examine the input file to see what was causing the data type mismatch ...
    (comp.lang.perl.misc)
  • Re: DBI, postgresql and large table
    ... I need to process postgresql table with DBI module. ... * Have you tried to execute this command in an SQL editor (psql if I ...
    (perl.beginners)
  • Re: Error when calling a Oracle Stored Proc
    ... Can some one tell me why I get this error message when I call my Oracle ... Stored Procedure using the DBI Module? ... Did you maybe create the SP with another user than the one you use from your script? ...
    (comp.lang.ruby)
  • DBI installation help
    ... Can anyone here tell me the step by step procedure to install the DBI module in perl for database access via a script. ...
    (perl.dbi.users)