v.18.16New Feature

Added Key Indicator Columns to system.columns Table

Added the is_in_partition_key, is_in_sorting_key, is_in_primary_key, and is_in_sampling_key columns to the system.columns table. #3609
Added the is_in_partition_key, is_in_sorting_key, is_in_primary_key, and is_in_sampling_key boolean columns to the system.columns table in ClickHouse.

Why it matters

These new columns provide detailed metadata about each column's role in the table structure, indicating whether a column is part of the partition key, sorting key, primary key, or sampling key. This enhances visibility and helps users better understand and optimize their table schemas.

How to use it

Query the system.columns table to inspect the new boolean columns is_in_partition_key, is_in_sorting_key, is_in_primary_key, and is_in_sampling_key to check if a specific column participates in the corresponding key. For example:

SELECT name, is_in_partition_key, is_in_sorting_key, is_in_primary_key, is_in_sampling_key
FROM system.columns
WHERE table = 'your_table_name'


No additional configuration is required to use this feature.