Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: algorithm help for determining efficient db data retrievalby tilly (Archbishop) |
on Apr 06, 2004 at 02:14 UTC ( [id://342808]=note: print w/replies, xml ) | Need Help?? |
Without extensive analysis and knowledge of your particular usage parameters, no solution is best. There are solutions that are good, but situations can be found where one outperforms another, and vice versa. The usual heuristic for this kind of problem is to fetch back well defined and simple sets of properties every time you fetch an object (typically "all") and then cache results (eg with a strategy similar to Memoize) so that you can decide on the fly what objects you don't need to fetch back again. If you're fetching lots of things for differing reasons then trying to be really clever about being minimal in what you fetch generally loses to having big simple categories. Plus a KISS strategy takes less work. A widely used module that attempts to address this problem is Class::DBI. See the section on Lazy Population.
In Section
Seekers of Perl Wisdom
|
|