[Dbix-class] Why is this so slow?

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Tue Jun 8 14:53:36 GMT 2010


On 8 Jun 2010, at 15:17, Chris Cole wrote:
> 
> Which when run in an SQL client takes <1 sec to run and via 'normal' DBI the full code still runs in ~1.5 min. So, there's nothing wrong with the SQL. There seems to be something up with DBIC. This is DBIC v0.08122 BTW.

How many rows are there in the database?
Also what version of perl and on what platform?

Did you install DBIC yourself - if not grab a copy and make sure you
run the test
	t/zzzzzzz_perl_perf_bug.t

which checks for installations which have strangely slow object
creation characteristics....

Also try replacing this:-
  while (my $hit = $rs->next()) {
     my $freq = $hit->get_column('mp_freq');
     $nHits += $freq;
  }

with
  $nHits = $rs->get_column('mp_freq')->sum();

[Look at http://search.cpan.org/perldoc?DBIx::Class::ResultSetColumn
for an idea as to whats happening here - the get_column is a resultset
method not a row method]

	Nigel.
--
[ 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 mailing list