mysql 中 insert 大量数据 避免时间戳相同 !!

Posted on   o0o0o9  阅读(518)  评论(0编辑  收藏  举报

时间函数 now() current_timestamp() 和 sysdate() 

CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().

也就是说 CURRENT_TIMESTAMP和 CURRENT_TIMESTAMP()都是 NOW()这个函数的同义词,所以作用相同,

 

 

而sysdate()函数的解释是

SYSDATE() returns the time at which it executes. This differs from the behavior for NOW(), which returns a constant time that indicates the time at which the statement began to execute. (Within a stored function or trigger, NOW() returns the time at which the function or triggering statement began to execute.)

简单来说,now()current_timestamp())函数获得的是语句开始执行时的时间,而sysdate()函数是这个函数执行时候的时间。

 

 

所以 Insert into tablea  (a,b,c,inserttime) select a,b,c,sysdate(3) from tableb

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具

随笔 - 13, 文章 - 2, 评论 - 0, 阅读 - 7613

Copyright © 2025 o0o0o9
Powered by .NET 9.0 on Kubernetes

点击右上角即可分享
微信分享提示