[CDBI] quantity of DB queries

Mike Whitaker mike at mindcandydesign.com
Fri Jul 28 11:28:01 BST 2006


On 28 Jul 2006, at 10:32, Oliver Jeeves wrote:

> I'm concerned about the number of queries Class::DBI would need to  
> make to a database. My understanding is that if I were to do  
> something like this:
>
> my $obj = My::DB::Thing->retrieve(1);
> my $some_value = $obj->fk->value

[ snip ]
> To clarify, in the above example, I would expect the following DB  
> queries:
>
> Look up all values for row in thing table.
> Look up all values for row in table referenced by fk.

When CDBI does a retrieve, or analogous operation, it only retrieves  
the ESSENTIAL columns. You can change which these are by doing:

$class->columns(Essential => $class->columns);

or similar.



More information about the ClassDBI mailing list