Mysql:Changes in MySQL 5.6.4 (2011-12-20, Milestone 7):微秒支持、Innodb全文索引支持
Changes in MySQL 5.6.4 (2011-12-20, Milestone 7)
-
Incompatible Change: MySQL now permits fractional seconds for
TIME
,DATETIME
, andTIMESTAMP
values, with up to microseconds (6 digits) precision. To define a column that includes a fractional seconds part, use the syntax
, wheretype_name
(fsp
)type_name
isTIME
,DATETIME
, orTIMESTAMP
, andfsp
is the fractional seconds precision. For example:CREATE TABLE t1 (t TIME(3), dt DATETIME(6));
The
fsp
value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.)The following items summarize the implications of this change. See also Fractional Seconds in Time Values.
-
For
TIME
,DATETIME
, andTIMESTAMP
columns, the encoding and storage requirements in new tables differ from such columns in tables created previously because these types now include a fractional seconds part. This can affect the output of statements that depend on the row format, such asCHECKSUM TABLE
. -
Due to these changes in encoding and storage requirements for MySQL's
DATETIME
andTIMESTAMP
types, importing pre-MySQL 5.6.4InnoDB
tables usingALTER TABLE ... IMPORT TABLESPACE
that containDATETIME
andTIMESTAMP
types into MySQL 5.6.4 (or later) requires a workaround procedure which is described in the “Server Changes” section of Changes in MySQL 5.6 . -
Syntax for temporal literals now produces temporal values:
DATE '
,str
'TIME '
, andstr
'TIMESTAMP '
, and the ODBC-syntax equivalents. The resulting value includes a trailing fractional seconds part if specified. Previously, the temporal type keyword was ignored and these constructs produced the string value. See Standard SQL and ODBC Date and Time Literalsstr
' -
Functions that take temporal arguments accept values with fractional seconds. Return values from temporal functions include fractional seconds as appropriate.
-
Three
INFORMATION_SCHEMA
tables,COLUMNS
,PARAMETERS
, andROUTINES
, now have aDATETIME_PRECISION
column. Its value is the fractional seconds precision forTIME
,DATETIME
, andTIMESTAMP
columns, andNULL
for other data types. -
The C API accommodates fractional seconds as follows:
-
In the
MYSQL_FIELD
column metadata structure, thedecimals
member indicates the fractional seconds precision forTIME
,DATETIME
, andTIMESTAMP
columns. Clients can determine whether a result set temporal column has a fractional seconds part by checking for a nonzerodecimals
value in the correspondingMYSQL_FIELD
structure. Previously, thedecimals
member indicated the precision for numeric columns and was zero otherwise. -
In the
MYSQL_TIME
structure used for the binary protocol, thesecond_part
member indicates the microseconds part forTIME
,DATETIME
, andTIMESTAMP
columns. Previously, thesecond_part
member was unused.
-
In some cases, previously accepted syntax may produce different results. The following items indicate where existing code may need to be changed to avoid problems:
-
Some expressions produce results that differ from previous results. Examples: The
timestamp
system variable returns a value that includes a microseconds fractional part rather than an integer value. Functions that return a result that includes the current time (such asCURTIME()
,SYSDATE()
, orUTC_TIMESTAMP()
) interpret an argument as anfsp
value and the return value includes a fractional seconds part of that many digits. Previously, these functions permitted an argument but ignored it. -
TIME
values are converted toDATETIME
by adding the time to the current date. (This means that the date part of the result differs from the current date if the time value is outside the range from'00:00:00'
to'23:59:59'
.) Previously, conversion ofTIME
values toDATETIME
was unreliable. See Conversion Between Date and Time Types. -
TIMESTAMP(
was permitted in old MySQL versions, butN
)N
was a display width rather than fractional seconds precision. Support for this behavior was removed in MySQL 5.5.3, so applications that are reasonably up to date should not be subject to this issue. Otherwise, code must be rewritten.
NoteThere may be problems replicating from a master server that understands fractional seconds to an older slave that does not:
-
For
CREATE TABLE
statements containing columns that have anfsp
value greater than 0, replication will fail due to parser errors. -
Statements that use temporal data types with an
fsp
value of 0 will work for with statement-based logging but not row-based logging. In the latter case, the data types have binary formats and type codes on the master that differ from those on the slave. -
Some expression results will differ on master and slave. For example, expressions that involve the
timestamp
system variable or functions that return the current time have different results, as described earlier.
(Bug #8523, Bug #11745064)
-
-
MySQL now supports
FULLTEXT
indexes forInnoDB
tables. The core syntax is very similar to theFULLTEXT
capability from earlier releases, with theCREATE TABLE
andCREATE INDEX
statements, andMATCH() ... AGAINST()
clause in theSELECT
statement. The new@
operator allows proximity searches for terms that are near each other in the document. The detailed search processing is controlled by a new set of configuration options:innodb_ft_enable_stopword
,innodb_ft_server_stopword_table
,innodb_ft_user_stopword_table
,innodb_ft_cache_size
,innodb_ft_min_token_size
, andinnodb_ft_max_token_size
. You can monitor the workings of theInnoDB
full-text search system by querying newINFORMATION_SCHEMA
tables:innodb_ft_default_stopword
,innodb_ft_index_table
,innodb_ft_index_cache
,innodb_ft_config
,innodb_ft_deleted
, andinnodb_ft_being_deleted
.
-
Performance; InnoDB: New optimizations apply to read-only
InnoDB
transactions. See Optimizing InnoDB Read-Only Transactions for details. The new optimizations make autocommit more applicable toInnoDB
queries than before, as a way to signal that a transaction is read-only because it is a single-statementSELECT
. -
Performance; InnoDB: You can now set the
InnoDB
page size for uncompressed tables to 8KB or 4KB, as an alternative to the default 16KB. This setting is controlled by theinnodb_page_size
configuration option. You specify the size when creating the MySQL instance. AllInnoDB
tablespaces within an instance share the same page size. Smaller page sizes can help to avoid redundant or inefficient I/O for certain combinations of workload and storage devices, particularly SSD devices with small block sizes.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
2014-03-29 Oracle:create pfile from spfile:rac下要小心该操作啊!
2013-03-29 Oracle:管理 date类型 interval 动态变化的分区:查询、删除
2013-03-29 JDBC 访问 Oracle ,如果结果集 中的字段 含有【null】值,无法获得结果集