tags:

views:

180

answers:

1

Hi!

I have this intermittent problem with MySQL 5.1.33 (Community Server) for Windows, where the Update_time (when using SHOW TABLE STATUS) does not seem to get updated when executing UPDATE command.

  1. After connecting to MySQL, I executed "SHOW TABLE STATUS" command, and it returned Update_time: 2010-01-05 08:28:27

  2. I then executed an UPDATE command on the same table. It was successful, and shows "3501 rows affected"

  3. I, once again, executed "SHOW TABLE STATUS". However, it returned the same Update_time as in #1 (2010-01-05 08:28:27)

Note: I tried it using INSERT, instead of UPDATE, and the Update_time was successfully updated.

Isn't the UPDATE command suppose to affect the Update_time of the table? What puzzles me more is that this is an intermittent issue. Sometimes the UPDATE command works, but most of the time it just doesn't seem to have effect on the table's status.

Any information regarding this issue would be very helpful. Thanks!

+1  A: 

Show Table Status

*Update_time*:

"When the data file was last updated. For some storage engines, this value is NULL. For example, InnoDB stores multiple tables in its tablespace and the data file timestamp does not apply. For MyISAM, the data file timestamp is used; however, on Windows the timestamp is not updated by updates so the value is inaccurate."

This is from: Show Table - Update_time

CSharpAtl
I see. Is there a workaround to this? (Something that would inform my script that there has been updates to the table. Please note that the current database model does not have a field for "last update"). Or is the only way to fix this is to add the audit field?
Erwin Paglinawan
I would suggest either adding a field or having a trigger that would insert/update data on another table when data is updated.
CSharpAtl
I have also been toying with this solution. I guess, there isn't anything else that I can use using only the default MySQL properties. So much for hoping :). Anyway, thanks so much for the answers. :)
Erwin Paglinawan