v.18.16New Feature

Added Key Columns to system.tables for Table Key Information

Added the partition_key, sorting_key, primary_key, and sampling_key columns to the system.tables table in order to provide information about table keys. #3609
Added the partition_key, sorting_key, primary_key, and sampling_key columns to the system.tables table to provide detailed information about table keys.

Why it matters

This feature addresses the need for better introspection of table key structures by exposing key definitions directly in the system.tables metadata table. It enables users and administrators to easily query and understand the partition, sorting, primary, and sampling keys of tables without inspecting table definitions or schema files, thus improving database management and optimization processes.

How to use it

Users can query the system.tables table and check the new columns partition_key, sorting_key, primary_key, and sampling_key to get information about the respective keys for any table. For example:

SELECT database, name, partition_key, sorting_key, primary_key, sampling_key
FROM system.tables
WHERE database = 'your_database_name';