当运行UPDATE ... datetime = NOW();所有更新的行将具有相同的日期/时间? [英] When running UPDATE ... datetime = NOW(); will all rows updated have the same date/time?

查看:814
本文介绍了当运行UPDATE ... datetime = NOW();所有更新的行将具有相同的日期/时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您运行类似于

 更新表SET datetime = NOW(); $ 1 $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ 

$ b $ p

行具有完全相同的时间(分钟和秒),或者它们有不同的时间?换句话说,查询开始时或每一行是否更新的时候会是时候?



我正在运行MySQL,但我认为这适用于所有的dbs 。

解决方案

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now


NOW()返回一个常量时间,指示语句开始执行的时间(在存储的例程或触发器中, NOW()返回例程或触发语句开始执行的时间)与SYSDATE()的行为不同,SYSDATE()返回执行MySQL 5.0.13的确切时间。



When you run something similar to:

UPDATE table SET datetime = NOW();

on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be when the query started or when each row is updated?

I'm running MySQL, but I'm thinking this applies to all dbs.

解决方案

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now

"NOW() returns a constant time that indicates the time at which the statement began to execute. (Within a stored routine or trigger, NOW() returns the time at which the routine or triggering statement began to execute.) This differs from the behavior for SYSDATE(), which returns the exact time at which it executes as of MySQL 5.0.13. "

这篇关于当运行UPDATE ... datetime = NOW();所有更新的行将具有相同的日期/时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆