On 7/21/05, Tim Bunce <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 20, 2005 at 07:20:02PM -0500, Gerardo Santana G?mez Garrido wrote:
> > On 7/20/05, Tim Bunce <[EMAIL PROTECTED]> wrote:
> > > On Sun, Jul 03, 2005 at 03:47:11AM -0500, Gerardo Santana G?mez Garrido 
> > > wrote:
> > > > ---------- Forwarded message ----------
> > > > From: Gerardo Santana G?mez Garrido <[EMAIL PROTECTED]>
> > > > Date: Jun 29, 2005 1:46 PM
> > > > Subject: it works, but...
> > > > To: [EMAIL PROTECTED]
> > > >
> > > >
> > > > I'm sending you attached the output of it_works.
> > > >
> > > > DBD::Informix works fine, except that it's taking twice the time than
> > > > ESQL/C when I SELECT from a table and do a while($ref = $stmt->fetch)
> > > > { }
> > > >
> > > > This table has aprox. 250 fields and 8000 rows. It takes 199 seconds
> > > > for perl to execute the select and fetch all the records, while for
> > > > the program in ESQL/C (that selects, fetch, aggregates and prints a
> > > > report) it takes 72 seconds.
> > > >
> > > > Any ideas?
> > >
> > > Can you post the code that's calling the DBI? That's probably where
> > > most of the time is being spent.
> > >
> > > A very simple way to check that is to set the DBI_PROFILE env var to 1
> > > before running the script. Let us know what it says.
> >
> > Thanks. This is it:
> >
> > DBI::Profile: 215.947677s 93.72% (8587 calls) test.pl @ 2005-07-20 18:21:3
> >
> > That was with my original query, that joins four tables.
> >
> > This is with a simple "select * from table", where table has around 300 
> > fields:
> >
> > DBI::Profile: 143.146600s 91.56% (8588 calls) test2.pl @ 2005-07-20 18:33:00
> 
> Can you post the code?

Here it is (test2.pl):

======== 8< ========
#!/bin/perl

use DBI;
use strict; use warnings;

DBI->install_driver('Informix');

my $query = "select * from mytable";
my $database = "mydatabase";

my $dbh = DBI->connect("dbi:Informix:$database", '', '',
        { AutoCommit => 0, PrintError => 1 });

my $sth = $dbh->prepare($query, { ix_CursorWithHold => 1 });
$sth->execute;

while(my @row = $sth->fetchrow_array) {
}

if ($sth->{ix_sqlcode} < 0) {
        print "ERROR\n";
}

$sth->finish;
undef $sth;
$dbh->disconnect;

======== >8 ========

That's all, just a loop.

> 
> > By the way, I have just tested  the same on Solaris 2.6 with IDS 7.30
> > and I get this:
> > DBI::Profile: 1.697653s 59.09% (198 calls) test2.pl @ 2005-07-20 19:31:22
> >
> > So, I guess my HP environment is broken somewhere.
> 
> Yeap. The difference in the number of DBI method calls is very striking.
> 
> Tim.
> 


-- 
Gerardo Santana Gómez Garrido
http://www.openbsd.org.mx/santana/
"Entre los individuos, como entre las naciones, el respeto al derecho
ajeno es la paz" -Don Benito Juárez

Reply via email to