[Dbix-class] Lazy loading of attributes?
Jules Bean
jules at jellybean.co.uk
Thu Nov 10 17:40:12 CET 2005
Jesper Krogh wrote:
> Hi.
>
> I have a table with some quite large attributes that only should be
> fetched when they are accessed. In Class::DBI this was done by the
> "columns(Other => qw(att1 att2)) but that seems to fail in DBIx::Class
>
> How is this typically done in DBIx::Class?
>
The defaulting to lazy attributes was responsible for a lot of poor
performance. I imagine that's why DBIC doesn't default the same way.
(It's far better to make one big query than 1000 small ones).
Unfortunately I don't believe there's a way of setting some attributes
to 'dont select by default', but what you can do is add the cols
attribute to your searches, as in
->search({name=>"Jesper"},{cols=>qw/phone address email/}).
Jules
More information about the Dbix-class
mailing list