[CDBI] How well does Class::DBI scale?

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Mon Dec 19 13:42:43 GMT 2005

> > Let's say we have one hundred rows the refer to foreign key 86
> > in the units table. The units table has a (id,name) pair. I will
> > see one hundred SQL requests for (id=86,name) from the database!
> > I find this strange if the corresponding Unit object has already
> > been _flesh()'d out once.
> > 
> > Note that in the case of this Unit stuff, the only Essential
> > column is the primary key. Would this explain the behaviour?
> Yes, incorrect keys will cause tons of problems.  Fix your primary key
> so that the database and your Class::DBI classes agree on it.

I think the key is correct, no? It's the Essential columns that is
sub-optimal. As I understand what the OP said, units is a table with
[just?] two columns that are [nearly] always used together:

  id   - is the primary key
  name - is presumably text for display

But only id is in the Essential column group. If so, add name to the
Essential group and this will [approximately] halve the number of

Cheers, Dave

More information about the ClassDBI mailing list