ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Mysql:Changes in MySQL 5.6.4 (2011-12-20, Milestone 7):微秒支持、Innodb全文索引支持

2020-03-29 11:01:58  阅读:266  来源: 互联网

标签:12 20 5.6 seconds value DATETIME innodb fractional ft


Changes in MySQL 5.6.4 (2011-12-20, Milestone 7)

Fractional Seconds Handling

  • Incompatible Change: MySQL now permits fractional seconds for TIME, DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision. To define a column that includes a fractional seconds part, use the syntax type_name(fsp), where type_name is TIME, DATETIME, or TIMESTAMP, and fsp 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, and TIMESTAMP 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 as CHECKSUM TABLE.

    • Due to these changes in encoding and storage requirements for MySQL's DATETIME and TIMESTAMP types, importing pre-MySQL 5.6.4 InnoDB tables using ALTER TABLE ... IMPORT TABLESPACE that contain DATETIME and TIMESTAMP 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 'str', and TIMESTAMP 'str', 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 Literals

    • 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, and ROUTINES, now have a DATETIME_PRECISION column. Its value is the fractional seconds precision for TIME, DATETIME, and TIMESTAMP columns, and NULL for other data types.

    • The C API accommodates fractional seconds as follows:

      • In the MYSQL_FIELD column metadata structure, the decimals member indicates the fractional seconds precision for TIME, DATETIME, and TIMESTAMP columns. Clients can determine whether a result set temporal column has a fractional seconds part by checking for a nonzero decimals value in the corresponding MYSQL_FIELD structure. Previously, the decimals member indicated the precision for numeric columns and was zero otherwise.

      • In the MYSQL_TIME structure used for the binary protocol, the second_part member indicates the microseconds part for TIME, DATETIME, and TIMESTAMP columns. Previously, the second_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 as CURTIME(), SYSDATE(), or UTC_TIMESTAMP()) interpret an argument as an fsp 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 to DATETIME 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 of TIME values to DATETIME was unreliable. See Conversion Between Date and Time Types.

    • TIMESTAMP(N) was permitted in old MySQL versions, but 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.

    Note

    There 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 an fsp 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)

InnoDB Notes

Functionality Added or Changed

  • 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 to InnoDB queries than before, as a way to signal that a transaction is read-only because it is a single-statement SELECT.

  • 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 the innodb_page_size configuration option. You specify the size when creating the MySQL instance. All InnoDB 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.

 

标签:12,20,5.6,seconds,value,DATETIME,innodb,fractional,ft
来源: https://www.cnblogs.com/jinzhenshui/p/12591209.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有