官术网_书友最值得收藏!

PostgreSQL native data types

When designing a database table, you should take care to pick the appropriate data type. When the database goes to production, changing the data type of a column can become a very costly operation, especially for heavily-loaded tables. The cost often comes from locking the table, and in some cases, rewriting it. When picking a data type, consider a balance between the following factors:

  • Extensibility: Can the maximum length of a type be increased or decreased without a full table rewrite and a full table scan?
  • Data type size: Going for a safe option, such as choosing big integers instead of integers, will cause more storage consumption.
  • Support: This factor is important for rich data types, such as XML, JSON, and hstore. If the drivers, such as JDBC drivers, don't support rich types, you need to write your own code to serialize and deserialize the data.

PostgreSQL provides a very extensive set of data types. Some of the native data type categories are as follows:

  • Numeric type
  • Character type
  • Date and time types

These data types are common for most relational databases. Moreover, they are often sufficient for modeling traditional applications.

主站蜘蛛池模板: 邵阳市| 南投市| 确山县| 库尔勒市| 龙川县| 来凤县| 张北县| 澄江县| 赣榆县| 会宁县| 马尔康县| 大庆市| 麦盖提县| 卢氏县| 龙胜| 湄潭县| 绥芬河市| 宁津县| 孟连| 朝阳县| 双桥区| 台南县| 高阳县| 北安市| 保靖县| 荥经县| 景泰县| 瓦房店市| 安化县| 三原县| 柞水县| 潮安县| 溧阳市| 宣恩县| 桐乡市| 西青区| 沙湾县| 遵义市| 古蔺县| 九龙县| 青浦区|