ClickHouse Table Creation Rules
This topic describes the rules and suggestions for creating ClickHouse tables.
Table Creation Rules
- [Rule] Do not create service tables in the system database. The system database in ClickHouse is the default database that stores system configurations and metadata. Service-related tables should be created in their own service databases to prevent unnecessary impact on the system database.
- [Rule] Do not use SQL reserved words in database and table names. Ensure that the names are case-sensitive. If reserved keywords must be used, enclose them in double quotation marks or backquote for escape.
- [Rule] Do not use the character type to store time or date data, especially when date fields are used for calculation or comparison.
- [Rule] Do not use the character type to store numeric data, especially when numeric fields are calculated or compared.
- [Suggestion] Avoid using the Nullable column in a table. Instead, use the string "NA".
When a Nullable column is used in query condition judgments, the system checks whether the column is empty, adding extra calculation overhead. Historical data shows that the query performance of the Nullable type is 20% to 30% slower than that of the String type. Therefore, the Nullable type should be used only when necessary.
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