[CDBI] Null Column Causing Repeated DB Calls

Aaron Dalton aaron at daltons.ca
Fri Feb 26 17:28:42 GMT 2010


On 26/02/2010 9:21 AM, eric.berg at barclayscapital.com wrote:
> I'm optimizing one of my cdbi classes and found that one of my columns often contains a NULL value, and when I iterate through a set of results from a search_* query, when I attempt to do assignments of that attribute, cdbi is making another call to the db just to retrieve that value, when it's value is NULL slowing things down considerably.
> 
> I'm about to try to override the accessor for that column, but I'm wondering if there's a way to address this issue within cdbi in general.
> 
> Anybody have any advice on the matter?
> 

I'm a relative n00b, but can't you just declare that column as "Other"?
 That should mean it won't every fetch the value unless explicitly
requested.

http://search.cpan.org/~tmtm/Class-DBI-v3.0.17/lib/Class/DBI.pm#LAZY_POPULATION

Aaron




More information about the ClassDBI mailing list