Well it would help to look at your code.  Is it an insert statement that is
taking so long, or are you selecting from somewhere too.  You can prepare an
insert statment and then execute within a block.  Also finishing a statement
handle is not necessary, even if you are repreparing.

$sth = $dbh->prepare("insert into foo (bar1, bar2, bar3) values (?,?,?)");

while (condition)
{
$sth->execute($val1, $val2, $val3);
}

Ilya

-----Original Message-----
From: Chouda, Prem
To: [EMAIL PROTECTED]
Sent: 7/30/01 1:07 PM
Subject: How can I effeciently use Prepared Statement ?

Hi All,

I am dumping more than 4 Millions of records from Database file to
RDBMS.
Here is the thing that I am doing.

1. Connecting to RDBMS and getting the $dbh
2. Opening the Database and reading all its records in LOOP
        -- Creating the $sth as $sth=$dbh->prepare($sqlstmt)
        -- Executing the $sth  and
        -- Closing the $sth
3. Closing the Database file and
4. Disconnecting the $dbh.

I thought this the way how to integrate it. But when I tested my script
it
is taking more than 3 hrs in dumping all those records.

Is there something possible, where I can create the Statement once and
use
it everytime instead of creating & finishing for each and every record ?
OR
is there any alternative to make it effecient ?

Help || Recommendation || comments are appreciated :-)


Regards
Prem

Reply via email to