【问题标题】:How do I add an index to a column that is datetime?如何将索引添加到日期时间的列?
【发布时间】:2011-02-03 21:13:28
【问题描述】:

可能重复
How does one create an index on the date part of DATETIME field in MySql

在 mysql 中。这是一个日期列

【问题讨论】:

标签: mysql database


【解决方案1】:

您的操作方式与处理任何其他列类型的方式相同:

CREATE INDEX IX_tblname_columnname
ON tbl_name (columnname)

有关更多信息和其他选项,请参阅the documentation

【讨论】:

  • 如果我在我的主服务器上创建这个索引,它会被复制到我的从服务器上吗?
  • @alex: 我不知道,但是你可以通过在你的奴隶上运行SHOW CREATE TABLE tblname 来检查索引是否存在。
猜你喜欢
  • 2017-05-22
  • 1970-01-01
  • 2013-01-22
  • 2021-09-27
  • 2019-09-23
  • 2015-10-13
  • 2015-01-04
  • 2021-03-12
  • 1970-01-01
相关资源
最近更新 更多