DEV Community

Michael
Michael

Posted on • Originally published at gbase.cn

What Statements Are Allowed in GBase 8a READONLY Mode? SHOW, USE, and More

When a GBase 8a cluster is set to READONLY mode, SELECT is not the only allowed operation. Statements that don't modify user data or cluster metadata — like SHOW, USE, and DESCRIBE — continue to work normally.

Permitted Statements

  • Data queries: SELECT is the central operation allowed in read‑only mode.
  • Metadata and status inspections: All SHOW variants (SHOW DATABASES;, SHOW TABLES;, SHOW COLUMNS FROM ...;, SHOW PROCESSLIST;, etc.), DESC/DESCRIBE, and queries against INFORMATION_SCHEMA or PERFORMANCE_SCHEMA.
  • Session‑level commands: USE database_name; only changes the current database context for the session without touching persisted data. SET for session variables (e.g., SET NAMES utf8;) is also allowed.
  • Selected administrative commands: KILL QUERY terminates a running query — a connection‑management action that does not alter business data.

Prohibited Statements

  • DDL: CREATE, ALTER, DROP, TRUNCATE
  • DML: INSERT, UPDATE, DELETE
  • LOAD: LOAD DATA INFILE
  • Privilege changes: GRANT, REVOKE

Why SHOW and USE Are Allowed

The whole point of READONLY mode is to freeze data during maintenance tasks — node expansion, replacement, or backup — ensuring user data and schema stay unchanged. Yet DBAs and applications still need to inspect tables, review structures, and monitor the cluster.

  • SHOW commands are pure reads; they gather information from system catalogs without any write risk.
  • USE merely updates a pointer in the client's session memory; it generates no disk I/O, transaction log, or DDL coordination.
  • Neither statement touches transactional logs, data files, or distributed DDL synchronization, so they don't interfere with background maintenance.

Because they are inherently read‑only or only modify session state, they are permitted. This design balances data safety with operational continuity — you can keep "looking" at your gbase database while the cluster remains in maintenance mode.

Top comments (0)