Last update time mysql




















Cancel Not a member? Sign Up Forgot Password? For example we are adding names to a user or member table. In the member table there will be more fields like name, email, password etc but for simplicity we will use three fields only. One field is id which is a auto increment field, next one is name field and last tm is a datetime field. Here once we add name to the table the id automatically gets generated as it is an auto increment field and the field tm stores the date and time value showing the time of record insertion.

We are not inserting current date time by calculating through PHP to the table like given here. Get the Time of Last update of a column Ask Question. Asked 8 years, 6 months ago. Active 5 years ago.

Viewed 45k times. I hope I explained well my problem. Improve this question. Evan Carroll - Use SO instead Add a comment. Active Oldest Votes. Improve this answer. Refrain from depending on this value. ShlomiNoach what was I thinking? I just answered this one on that : stackoverflow. So bad, for ur suggestion I can't use triggers because I want to know the time of last update of a specific column from a system table.

And Thanks for ur answer. John Demetriou John Demetriou 3 3 bronze badges. This does not seem to persist on restart for me on version 5. Show 6 more comments. Meloman 3, 3 3 gold badges 38 38 silver badges 41 41 bronze badges. Bill Karwin Bill Karwin k 82 82 gold badges silver badges bronze badges. The question really wants to know when relevant data is updated, and not when a table which is irrelevant to the user may or may not have been changed for whatever reason. Ammamon, true, if you also need to account for deletions, this solution doesn't reflect that.

A trigger to update a summary table may be the only comprehensive solution, but that would create a bottleneck. Pavan, there is no difference, you're just relying on the default behavior, and my example spells out the option explicitly.

But the option is identical to the default behavior. Show 14 more comments. Radu Maris Radu Maris 5, 4 4 gold badges 38 38 silver badges 54 54 bronze badges. By default, the data is stored in ibdata1 so the ibd file timestamp will not update when data is changed in the table.

StackUnderflow, What you've said is not accurate. The ibd files store data and indexes for a tablespace, which contains one or more tables. If the data is stored in ibdata1, there will be no ibd file. Storing data in one file per table has been the default since MySQL 5. Pablo Bianchi 1, 1 1 gold badge 19 19 silver badges 27 27 bronze badges. Francois Bourgeois Francois Bourgeois 3, 5 5 gold badges 29 29 silver badges 40 40 bronze badges.

Any idea? Xaraxia but some of them are not null, do you know why? That's the most likely reason that I can think of. Mikhail Mikhail 1, 5 5 gold badges 22 22 silver badges 33 33 bronze badges. Soul Reaver Soul Reaver 1, 3 3 gold badges 34 34 silver badges 45 45 bronze badges.

Simas Joneliunas 2, 13 13 gold badges 22 22 silver badges 30 30 bronze badges. Just grab the file date modified from file system.

Matthias Robbers Steve Wood Steve Wood 21 2 2 bronze badges. Filesystem checks aren't useful if your database is running on a separate server — Sam Dufel.

Welcome to StackOverflow! Please edit your answer to include some of the code you used, as well as an explanation of why you chose to do it this way. This question is almost eleven years old , and already has an accepted, well-upvoted answer. Your answer, without some code or an explanation, will likely be downvoted or deleted. Editing it to include those things will help justify its place on this post.

This is what I did, I hope it helps.



0コメント

  • 1000 / 1000