-
Book Overview & Buying
-
Table Of Contents
AI-Ready PostgreSQL 18
By :
Data comes in many forms and shapes. Data types are used to characterize data – for example, defining that a data element is a 25-character-long string, and the operations that can be executed on that string – for example, appending to the string, searching within it, or replacing a substring. Choosing the correct data type is essential, as the data types define what the application can expect, what the developer needs to consider, and how the application will perform.
When developers choose a data type, we recommend that they follow a golden rule:
Choose the most specific type that accurately represents your domain, provides the right operators, and can comfortably hold your expected data range.
For example, don't choose INTEGER to store Boolean true/false data, as INTEGER (4 bytes) uses four times as much space as BOOLEAN (1 byte). Making the right choice minimizes I/O and provides developers with powerful tools that...