当运行 UPDATE ... datetime = NOW();所有更新的行都会有相同的日期/时间吗?

When running UPDATE ... datetime = NOW(); will all rows updated have the same date/time?(当运行 UPDATE ... datetime = NOW();所有更新的行都会有相同的日期/时间吗?)
本文介绍了当运行 UPDATE ... datetime = NOW();所有更新的行都会有相同的日期/时间吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你运行类似的东西时:

When you run something similar to:

UPDATE table SET datetime = NOW();

在具有 1 000 000 000 条记录且查询需要 10 秒才能运行的表上,所有行的时间是否完全相同(分钟和秒)还是不同的时间?换句话说,是查询开始的时间还是每行更新的时间?

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?

我正在运行 MySQL,但我认为这适用于所有数据库.

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() 返回一个常数时间,指示语句开始执行的时间.(在存储的例程或触发器中,NOW() 返回例程或触发语句开始执行的时间.)此与 SYSDATE() 的行为不同,它返回从 MySQL 5.0.13 开始执行的确切时间."

"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();所有更新的行都会有相同的日期/时间吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)