in reply to Of Mysql, DBI and PK best practices

It sounds like you have more than one piece of information for a given PK. In that case, you should be using two tables. Think about it in terms of invoices and lineitems. You go buy 3 things from CDW. You get one invoice indicating the date of purchase, the payer, the shipto address, CDW's invoice ID, etc. That's a record in the invoices table. But, you need to indicate the three lineitems. So, you have a lineitems table which has a FK back to the invoices table.

Same idea here.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: Of Mysql, DBI and PK best practices

Replies are listed 'Best First'.
Re^2: Of Mysql, DBI and PK best practices
by jimbus (Friar) on Apr 17, 2007 at 14:18 UTC

    Dragonchild,

    I was deliberately being 'data neutral' to keep focus on the mechanics... The PK is a date-time based on yyyy-mm-dd hh::00:00 and the information comes from multiple nodes from one system. In the end, I need a report on the usage of all of the nodes and the total for the system based on time. Additionally, log files are 'line count' based, so hours often overlap the files which are processed every 15 minutes.

    However, thanks for taking the time :)


    --Jimbus aka Jim Babcock
    Wireless Data Engineer and Geek Wannabe
    jim-dot-babcock-at-usa-dot-com