Dan Jakubiec wrote:

Hi.  I want to insert/update multiple rows into a table which has a
timestamp field, and I want to set the timestamp field in each row to the
current timestamp.  However, it is important to me that all the rows I
update actually end up with the same timestamp value.

My concern is: what happens if the SQL query take a long time and the
current timestamp crosses a second boundary? For example, suppose I issue
the following request on a very large table:

 UPDATE ts SET my_timestamp=NULL;

Say that this query takes 3 seconds to complete.  My questions:

1) Will all the rows have the same timestamp value? Or will some rows have
"now", "now+1", and "now+2"?

2) Will the behavior be different if I use "my_timestamp=NOW()"?

3) If the timestamps will be different, what's the best way to make them all
the same?


In the manual it says that all calls to now() in a query always return the same time regardless of how many there are and how long it takes the query to run so I am thinking that all records with an auto update time stamp column that get changed in a single query would all have the same time stamp. It should be easy enough to test if you have a large set of data where an update would take a long time. I'm pretty sure it will do what you need though and set them all the same.

--
Chris W
KE5GIX

Gift Giving Made Easy
Get the gifts you want & give the gifts they want One stop wish list for any gift, from anywhere, for any occasion!
http://thewishzone.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to