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

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.

主站蜘蛛池模板: 贞丰县| 海淀区| 若羌县| 宁德市| 茂名市| 五家渠市| 南召县| 夏邑县| 湘潭县| 三门峡市| 齐河县| 进贤县| 永年县| 江都市| 买车| 云阳县| 锡林浩特市| 荆门市| 琼海市| 东辽县| 洪泽县| 莲花县| 福安市| 卢氏县| 慈利县| 犍为县| 南郑县| 伊通| 藁城市| 高台县| 祁阳县| 浏阳市| 奉新县| 江津市| 广州市| 孟连| 天峻县| 甘德县| 聊城市| 大新县| 中超|