ClickHouse DB::Exception: Code: 60, e.displayText() = DB::Exception: Table is read-only
The table is set to read-only mode.
Debug clickhouse automatically with DrDroid AI →
Connect your tools and ask AI to solve it for you
What is ClickHouse DB::Exception: Code: 60, e.displayText() = DB::Exception: Table is read-only
Understanding ClickHouse
ClickHouse is a columnar database management system (DBMS) designed for online analytical processing (OLAP) of queries. It is known for its high performance and efficiency in handling large volumes of data. ClickHouse is widely used for real-time analytics and is capable of processing billions of rows and petabytes of data per second.
Identifying the Symptom
While working with ClickHouse, you might encounter the following error message: DB::Exception: Code: 60, e.displayText() = DB::Exception: Table is read-only. This error indicates that an attempt to modify a table has failed because the table is in read-only mode.
Explaining the Issue
Understanding Error Code 60
Error Code 60 in ClickHouse is associated with operations that are not permitted due to the table being in a read-only state. This can occur when the table's settings have been configured to prevent any write operations, which is useful in scenarios where data integrity must be preserved or when the table is used for reporting purposes only.
Why Tables Become Read-Only
Tables may be set to read-only mode intentionally by database administrators to prevent accidental data modifications. This setting is often applied to critical datasets or during maintenance windows. Additionally, certain configurations or system settings might inadvertently set tables to read-only mode.
Steps to Resolve the Issue
Check Table Settings
First, verify the current settings of the table to confirm its read-only status. You can do this by executing the following query:
SHOW CREATE TABLE your_table_name;
Review the output to identify any settings that enforce read-only mode.
Modify Table Settings
If you have confirmed that the table is indeed set to read-only, you can change its settings to allow write operations. Use the following query to alter the table settings:
ALTER TABLE your_table_name MODIFY SETTING readonly = 0;
This command changes the table's setting to allow write operations. Ensure you have the necessary permissions to execute this command.
Verify Changes
After modifying the table settings, verify that the changes have been applied successfully. Attempt a write operation to ensure that the table is no longer in read-only mode.
Additional Resources
For more information on managing ClickHouse tables and settings, refer to the official ClickHouse Documentation. Additionally, explore the Settings section for detailed explanations of various configuration options.
Still debugging? Let DrDroid AI investigate for you →
Connect your tools and debug with AI
Get root cause analysis in minutes
- Connect your existing monitoring tools
- Ask AI to debug issues automatically
- Get root cause analysis in minutes