What Is the Maximum Number of Columns in a Single GaussDB Table?
Answer: 1,600. The specific value varies according to the column type. The column type is not verified during table creation but is verified during data storage. For example, for a column of the bigint type, each column stores 8-byte data. If there are 1,600 columns, 12,800 bytes need to be stored, which exceeds the page capacity (8 KB), and an error is reported during insertion.
If the data length of a column exceeds the upper limit, the column may be stored in a TOAST table. The logic is as follows:
- If the total length of a tuple exceeds 2 KB, the longest column is compressed first.
- A column is stored in a TOAST table only when its data length exceeds the size limit after compression and is larger than the TOAST metadata overhead (24 bytes).
- A TOAST table stores the full data of each column, while the main table stores only query metadata.
- After compression, if the total length of a single row exceeds the size of a single page (8 KB), an error is reported regardless of whether a TOAST table is used. If a TOAST table is used, the main table stores its metadata; otherwise, it stores the compressed column data.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot