MySQL社区

标题: 关于timestamp的比较问题 [打印本页]

作者: bennycyb    时间: 2015-1-9 11:05
标题: 关于timestamp的比较问题
简单来说,就是在表中对timestamp数据进行比较时
发现select timestamp1 from table1 where timestamp1 < current_timestamp的数据库查询耗时远高于
select unix_timestamp(timestamp1) from table1 where unix_timestamp(timestamp1) < unix_timestamp(current_timestamp)

造成这个问题的原因是因为timestamp在mysql中的实际存储格式?
还是其他原因啊?
是不是应该在比较timestamp前始终使用unix_timestamp将其进行转换?





欢迎光临 MySQL社区 (http://www.mysqlpub.com/) Powered by Discuz! X3.2