in reply to Basic Perl trumps DBI? Or my poor DB design?

It's entirely possible that for a given application file access is faster than DBI -- after all, an RDMBS stores its data in files anyway. The real strength of an RDBMS is in the 'R': Relational.

While linear selects are probably faster if you can hand-optimize your file access with a Perl script, an RDBMS shines with non-linear data. With proper indexes, an RDBMS can return results for fairly complicated relationship queries incredibly quickly.

Of course, you could code that functionality for your specific queries yourself; indexing and optimizing for a specific set of queries isn't terribly difficult. But, the RDBMS can be maintained much more easily -- it's optimizations won't fall apart when you add a new query or change an existing one.

If speed truly is everything, then you probably are best off hand-coding a select routine; but if anything else is a consideration, you're probably best to see what optimization you can do with your RDBMS.

radiantmatrix
require General::Disclaimer;
"Users are evil. All users are evil. Do not trust them. Perl specifically offers the -T switch because it knows users are evil." - japhy
  • Comment on Re: Basic Perl trumps DBI? Or my poor DB design?