mysql - Which method for storing creation date, update, creator ... should I use -


i designing database site heavily datadriven forums , chat , other community features.

my question this: have identified information store @ least of tables. creation date, last update, creator , others.

which best way store these, in dedicated table or fields in each respective table?

why better solution better? can opinion of best solution change if have 50 tables or 100 tables? 100 000 records vs 4 million?

are there other aspects?

creation date , last update date best stored columns in same table respective data. doing that, can use timestamp data type updated automatically when respective rows change.

the null timestamp on row_created column default timestamp when row created. in row_updated, timestamp updated automatically every time row modified in way. not need modify them in application code.

create table test.table (   row_created timestamp null,   row_updated timestamp default current_timestamp on update current_timestamp ) 

the creator user isn't critical store in same table, doesn't hurt in same table or another. simplicity keep in same table.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -