[CDBI] Re: Many-to-Many - why no CDBI::Relationship?
"Ryan Tate" <lists-UNebACArQA1Wk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
On 8/21/06, Edward J. Sabol <sabol-2oVx0MVsMgiP/[email protected]> wrote: > I've always been happy enough with the standard method for > defining many-to-many relationships in Class::DBI, I'm curious if you have any sense how this performs this under load. I want to go beyond CDBI's native many-to-many support because it requires an extra db query for each and every associated item you want to flesh out, as oppposed to one query for all items. But maybe these simple SQL queries aren't much of a load? In my own benchmarks with my particular rdbms (the usual one, say what you will of it), a join always wins out over many simple connects. In fact, number of db connects seems to govern performance to the total exclusion of query complexity, even though every join "way" multiplies the number of records the rdbms has to sift through (table1recordCount * table2recordCouunt * table3recordCount). But I have not exposed any of my CDBI stuff to trafficked sites yet, so my benchmarks are sort of in a vaccum. > Aaron Trevena created the HasManyOrdered Relationship which claims to support > many-to-many relationships. Thanks for this. The POD, which I read previously, doesn't really play up the many-to-many support or make it super clear that it is more efficient than vanilla CDBI at this, but I looked in the source and his join code looks almost exactly like what I just wrote for myself! That'll teach me to dig deeper on CPAN next time.