What is the maximum number of columns in a single GaussDB table?
Answer: 1600. The 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 1600 columns, 12800 bytes need to be stored, which exceeds 8 KB on a page, and an error is reported during insertion.

If the data length of a column exceeds the maximum allowed, the data may be stored in a TOAST table. The logic is as follows:
- If the total length of a tuple exceeds 2 KB, the column containing the longest data is compressed first.
- Toast table storage is enabled only when the data length of a column 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, an error is reported if the total length of a single row exceeds the size of a single page (8 KB) 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.
Feedback
Was this page helpful?
Provide feedbackThank 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