in reply to Improving on MS-SQL over DBI and DBD::ODBC

well most of what I'm going to say is standard DBI fare. If you're going to be inserting multiple records into the same table a structure like this is preferred for speed and security.

my %items_to_insert = (item1=>1, item2=>2); $statement = "INSERT INTO myTbl (itemName,itemNumber) VALUES(?,?); my $sth = $dbh->prepare($statement); foreach my $key (keys(%items_to_insert)) { $sth->execute($key,$items_to_insert{$key}); }
That prevents the statement from being repeatedly prepare by the database handle.

I would say that one call to a fetch_all type statement in DBI rather than individual row fetching would be preferred as well. You minimize the total network traffic that way (correct me if wrong here)

So in summary, my big points of advice for DBI in this case are


Grygonos

Replies are listed 'Best First'.
Re^2: Improving on MS-SQL over DBI and DBD::ODBC
by radiantmatrix (Parson) on Nov 24, 2004 at 18:53 UTC

    Of course I already use placeholders and such, but I typically only run a given SELECT statement once in this application, so it doesn't help much.

    As to the fetchall recommendation, I would usually agree; but I occasionally recieve in excess of 60,000 records and do so with several instances. Resources considerations become important.


    radiantmatrix
    require General::Disclaimer;
    Perl is