NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database, table, and column naming schemes

John Campbell jcampbell1 at gmail.com
Wed Oct 7 15:46:01 EDT 2009


On Wed, Oct 7, 2009 at 2:23 PM, Mitch Pirtle <mitch.pirtle at gmail.com> wrote:
>
> OTOH most object/document databases generate an internal identifier
> for scale, sharding and whatnot (like MongoDB). So there are valid
> reasons for going the auto increment route, but I do believe too many
> people just automatically design every table to rely upon it.

These databases can't do arbitrary joins, and so would never have a
many-to-many connector table.  In performant object stores, you would
store all the student ids with the class, and also store the class ids
with the student object.  To have a many-to-many relationship, you
must duplicate the data.

Adding auto_increments to connector tables is always bad form, IMO.
The auto increment can lead to duplication, provides no additional
information, breaks certain types of queries, bloats your sql code,
and slows down query performance.  I know of no good reason to add the
extraneous information to the table.

-John Campbell



More information about the talk mailing list