From: David Vallner Date: 2006-12-28T10:46:25+09:00 Subject: Re: Modified Single Table Inheritance --------------enig2D215BDA840148A7A161469D Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Ryan Glover wrote: >> I can't understand this. It's rather common that an ORM database schem= a >> has a number of tables in the same order of magnitude as there are mod= el >> classes. My biased opinion is that data should be modelled on the >> database level where you have some theorethical foundations about what= >> are "good shapes" for the data. It also doesn't hurt to at least make >> the DB schema somewhat document the data model - the data an applicati= on >> gathers / stores is the most likely part of it to persist in the long >> term. Of course, you're probably in a better position to judge this. >> >=20 > I guess my problem with 100's perhaps a 1000 tables is db performance. = > I don't have oracle, only mysql or postgres. Performance wise, wouldnt= =20 > it be better to have a few thousand rows in one table as opposed to a=20 > few dozen spread across 100's of tables? >=20 The history of computing knows only one answer to that question: benchmark. (And not even that's much of an answer.) However, I have very, very few doubts that separate tables would be faster in a read-mostly scenario. The records for that model are filtered at insert time instead of query time, and deciding between tables is probably way faster than on any ad hoc type index column. Generally, a well-designed schema will probably buy you more performance in the long run than any sort of peephole hand-optimizations. You want to minimize the number of round-trip hits on the database and the volume of the datasets retrieved for that (often conflicting goals), and a clear schema helps do just that. David Vallner --------------enig2D215BDA840148A7A161469D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFkyHHy6MhrS8astoRAuvFAJsHncs5yrEvFhi87+HgFGWuile6mgCeI/kw PqBjbS9atsfF2C6nhUUTLsg= =vwRq -----END PGP SIGNATURE----- --------------enig2D215BDA840148A7A161469D--