[Dbix-class] Why is this so slow?

Chris Cole chris at compbio.dundee.ac.uk
Tue Jun 8 15:31:29 GMT 2010


On 08/06/10 15:53, Nigel Metheringham wrote:
> 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?

~111m rows.

> Also what version of perl and on what platform?

perl v5.8.8 built for i386-linux-thread-multi on Centos Linux 5.5.

> 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....

Yes, I installed it via CPAN and the test completed fine, allegedly:
t/zzzzzzz_perl_perf_bug.t ........................ ok
t/zzzzzzz_sqlite_deadlock.t ...................... ok
All tests successful.


> 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]

Thanks, but this isn't the final code. It will be doing more with the 
other columns.
Cheers,

Chris




More information about the DBIx-Class mailing list