logo       
Google Custom Search
    AddThis Social Bookmark Button

prefetch too slow: msg#00168

Subject: prefetch too slow
Hi,

in Catalyst I get a resultset from five tables roughly like this:
(actualy there are more columns)

$rs = $c->model('MyAppDB:Tab1')->search(undef,
      {prefetch=> {rel1=>{rel2=>['rel3','rel4']}},
       select  => ['me.id','me.col2',
                   \'strftime(\'%s\',date)',
                  ],
       as      => [qw/id col2 col3/],
       rows    => 1000,
       page    = $page,
       },
       );

Then I step through the resultset like this:

while (my $row = $rs->next) {
  some stuff ...
}

The query takes around one minute nevertheless from a command line the same
one retrieves the data within one second.
The time is spent within the next method.
Is something wrong with this approach?

I've lived with it by limiting the rows option to 50 but now I'd like to
put all data (more than 10000 rows) into a file.

Is there a better and more efficient way?
Thanks much.
      
-- 
Radek





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>