Re: Is a "set current" TIMESTAMP operation atomic when updating/inserting multiple rows?

2006-07-23 Thread Dilipkumar

Hi,

If u update this statment like what u have mentioned it will be updated for 
all the rows.


update tablename set field name='2006-07-07 00:00:00';

Thanks & Regards
Dilipkumar
- Original Message - 
From: "Chris W" <[EMAIL PROTECTED]>
To: "Dan Jakubiec" <[EMAIL PROTECTED]>; "MYSQL General List" 


Sent: Monday, July 24, 2006 1:11 AM
Subject: Re: Is a "set current" TIMESTAMP operation atomic when 
updating/inserting multiple rows?




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]




** DISCLAIMER **
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail & notify us 
immediately at [EMAIL PROTECTED]



Watch the latest updates on Mumbai, with video coverage of news, events,
Bollywood, live darshan from Siddhivinayak temple and more, only on
www.mumbailive.in

Watch the hottest videos from Bollywood, Fashion, News and more only on
www.sifymax.com


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



Re: Is a "set current" TIMESTAMP operation atomic when updating/inserting multiple rows?

2006-07-23 Thread Dan Jakubiec

Ah, thanks Chris.  I should have looked there (I was studying the TIMESTAMP
sections, not NOW()).  The NOW() documentation also refers to the SYSDATE()
function which does the opposite (i.e. sets the time when the record
actually gets added).

So I'll go ahead and use the 'my_timestamp=NOW()' format in my queries.  Out
of curiosity, I wonder which of the two approaches 'my_timestamp=NULL'
uses...  NOW() or SYSDATE()?

-- Dan

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.



Re: Is a "set current" TIMESTAMP operation atomic when updating/inserting multiple rows?

2006-07-23 Thread Chris W

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]



Is a "set current" TIMESTAMP operation atomic when updating/inserting multiple rows?

2006-07-23 Thread Dan Jakubiec

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?

Thanks in advance,

--
Dan Jakubiec