- Learning PostgreSQL 11
- Salahaldin Juba Andrey Volkov
- 196字
- 2021-07-02 13:11:50
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.
推薦閱讀
- Java程序設(shè)計(慕課版)
- Java入門經(jīng)典(第6版)
- Building a Quadcopter with Arduino
- 大模型RAG實戰(zhàn):RAG原理、應(yīng)用與系統(tǒng)構(gòu)建
- Getting Started with Greenplum for Big Data Analytics
- Android開發(fā):從0到1 (清華開發(fā)者書庫)
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- Java EE Web應(yīng)用開發(fā)基礎(chǔ)
- IBM RUP參考與認(rèn)證指南
- SQL Server 2008實用教程(第3版)
- C/C++代碼調(diào)試的藝術(shù)
- Spring Boot學(xué)習(xí)指南:構(gòu)建云原生Java和Kotlin應(yīng)用程序
- Mastering Unity Scripting
- HTML 5與CSS 3權(quán)威指南(第4版·下冊)
- 零基礎(chǔ)學(xué)西門子PLC編程:入門、提高、應(yīng)用、實例