Storage limits of MySQL user-defined variables

前端 未结 1 794
陌清茗
陌清茗 2020-12-15 23:10

Under User-Defined Variables, the MySQL manual documents:

User variables can be assigned a value from a limited set of data types: integer, decimal, f

相关标签:
1条回答
  • 2020-12-15 23:48

    User variables use the same internal data types that MySQL uses for computations on column values. These internal types are big enough for all data types supported by MySQL.

    • Integers do not have ZEROFILL, as that is an additional property of the column, not of the data type itself. Furthermore, integer user variables do not have a width; when converted to text, they use just as many digits as needed.
    • Floating-point values do not have a scale. 64-bit IEEE floats are binary values, and have enough precision for about 18 decimal digits.
    • Strings should, in theory, hold any LONGTEXT value, if max_allowed_packet is large enough and you have enough memory. However, there is an undocumented limit of 16 MB for user variables, mentioned in bug 31898.
    0 讨论(0)
提交回复
热议问题