There's more than one way to do things | |
PerlMonks |
Re^2: Fetchrow questionby alainb (Initiate) |
on Mar 21, 2012 at 12:17 UTC ( [id://960768]=note: print w/replies, xml ) | Need Help?? |
Hi in fact the mais reason for this question is because we are experiencing performance issue, not only in speed but also the sql database who goes at 90-100% frequently and for a long time.
We searched on the web and there where people saying using Win32::ole will improve performance. So I did a test on a test database on another server The database is Microsoft SQL The scripts start by using dbi:ODBChere what it does select var1,var2,var3 from table then loop until var1 is empty ($var1,$var2,$var3) = $Sth1->fetchrow(); For 100000 records it took less than 2 seconds I did the same test but using Win32::OLE->new('ADODB.Connection'); I used the same select select var1,var2,var3 from table then i did the same loop and used $var1 = $RS->Fields(0)->value; $var2 = $RS->Fields(1)->value; $var3 = $RS->Fields(2)->value; $RS->MoveNext; for the same 100000 records it took 16 seconds this time So I suspected that something was related to having too much memory usage so I did in the same script test1 using dbi:ODBC:test test2 using Win32::OLE->new('ADODB.Connection'); test3 using dbi:ODBC:test and the result was identical both test1 and test3 took less than 2 sec and test2 still took 16 secs So I wondered if everything is in memory why so many difference.
In Section
Seekers of Perl Wisdom
|
|