System History Tables



TiDB Cloud Lake's system history tables provide Data Governance capabilities by automatically tracking database activities for compliance, security monitoring, and performance analysis.

Available Tables

TablePurposeKey Use Cases
query_historyComplete SQL execution audit trailPerformance analysis, compliance tracking, usage monitoring
access_historyData access and modification logsData lineage, compliance reporting, change management
login_historyUser authentication trackingSecurity auditing, failed login monitoring, access pattern analysis
profile_historyDetailed query execution profilesPerformance optimization, resource planning, bottleneck identification
log_historyRaw system logs and eventsSystem troubleshooting, error analysis, operational monitoring

Permissions

Access Restrictions:

  • Only SELECT and DROP operations are allowed
  • ALTER operations are prohibited for all users
  • Ownership cannot be transferred

Required Permissions:

To query system history tables, users need one of:

  • GRANT SELECT ON *.* (global access)
  • GRANT SELECT ON system_history.* (database access)
  • GRANT SELECT ON system_history.table_name (table-specific access)

Example:

-- Create audit role for compliance team CREATE ROLE audit_team; GRANT SELECT ON system_history.* TO ROLE audit_team; CREATE USER compliance_officer IDENTIFIED BY 'secure_password' WITH DEFAULT_ROLE='audit_team'; GRANT ROLE audit_team TO USER compliance_officer;

Configuration

TiDB Cloud Lake

✅ Automatically enabled - All system history tables are ready to use without any configuration.

Was this page helpful?