Hi,
I just wanted to get a little feedback on my table setup here (I am still pretty nooby when it comes to DB creation).
CREATE TABLE grid_data(
id INT NOT NULL AUTO_INCREMENT,
sid VARCHAR(10) NOT NULL,
data TEXT NOT NULL,
tm timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY(id, sid),
INDEX(sid)
)
Sid will be a 10 character “secret” id… This will be what I use in the URI:
http://foo.com/app/[B]1H2wS4z9ks[/B]
The data will probably be no longer than 255 chars, but I opted to go with TEXT just in case I need a little extra space.
The rest should be pretty self explanatory.
I plan on just creating new rows to the table and will never alter existing rows.
Q: Is the composite primary key necessary? I mean, I can see adding a primary key for id, but what about “sid”? I am not sure yet, but I think I will be querying the DB using the SID (and not ID).
Q: Is the index overkill?
In general, I am just looking for some feedback; Please keep in mind, I am still pretty fresh for when it comes to DB creation.
Thanks!
Micky