Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:35:20+00:00 2026-05-25T09:35:20+00:00

I have date_created and date_modified columns on each table in database. What are advantages/disadvantages

  • 0

I have date_created and date_modified columns on each table in database.

What are advantages/disadvantages setting timestamp columns at database using MySQL triggers vs setting them at application layer using PHP?

Which is easier to maintain and have better time synchronization when deployed across on many servers?

EDIT:
since Johan suggested setting timestamps in database is good, are these correct implementations?
additionally, is it good practice to have date_created and date_modified on every table?
or do you recommend adding them on certain tables?

date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
date_modified TIMESTAMP NOT NULL DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:35:21+00:00Added an answer on May 25, 2026 at 9:35 am

    Timestamp in the database.

    If you replicate in a master-slave setup, database timestamps are correctly replicated (using the original timestamp).

    You do not (!) set timestamps in triggers.

    Instead you specify them in the table definition, MySQL will automatically set the correct timestamp on insert and/or update.
    You only have to set them once, when you create (or alter) the table and that’s it.

    Could not be easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a mysql table and i have one column that has current timestamp
I have a date and time column in my mysql table called start_date and
What are the advantages/disadvantages to each method? I know I've read somewhere in either
I have a bunch of entities with both a date_created and date_modified field, and
I have a table containing reports and the date/time they were created. I'd like
I have a DataGridView that's bound to a DataSet. It has columns DateCreated, Weight,
I have a project table with projectId as primary key: **projectId**, projectName, dateCreated, etc.
I have a need to change the length of CHAR columns in tables in
In MySQL, I'm sick of adding the columns dt_created and dt_modified (which are date
I have a table course: CREATE TABLE course (COURSE_NO NUMERIC(8,0) NOT NULL ,DESCRIPTION VARCHAR(50)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.