[Dbix-class] Why is this so slow?
nigel.metheringham at dev.intechnology.co.uk
Tue Jun 8 15:50:21 GMT 2010
A loop over 100 million rows with multiple object inflation for each row is
going to suck a serious amount of CPU time.
[Even more horribly, if you are using some databases - for example DBD::Pg -
then you are almost certainly not using a cursor or chunk at a time approach
but instead sucking the whole query output into local memory and then
(if you are lucky) rolling over it a few objects at a time, or if you
are unlucky building all those objects in memory at once!]
You may be able to approach the speed of pure DBI if you use
>> Also what version of perl and on what platform?
> perl v5.8.8 built for i386-linux-thread-multi on Centos Linux 5.5.
I use Centos myself (although I don't have 5.5). The perl is sluggish
with object handling on versions up to 5.4, although the show stopper bug
has now gone.
In general though you don't want to be iterating over that number of
rows manually if you can avoid it...
[ Nigel Metheringham Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
More information about the DBIx-Class