ClickHouse/docs/en/operations/system-tables/projections.md

1.8 KiB

slug
/en/operations/system-tables/projections

projections

Contains information about existing projections in all the tables.

Columns:

  • database (String) — Database name.
  • table (String) — Table name.
  • name (String) — Projection name.
  • type (Enum) — Projection type ('Normal' = 0, 'Aggregate' = 1).
  • total_rows, (UInt64) — Total number of rows.
  • data_compressed_bytes (UInt64) — The size of compressed data, in bytes.
  • data_uncompressed_bytes (UInt64) — The size of decompressed data, in bytes.
  • sorting_key (Array(String)) — Projection sorting key.
  • query (String) — Projection query.

Example

SELECT * FROM system.projections LIMIT 2 FORMAT Vertical;
Row 1:
──────
database:                default
table:                   landing
name:                    improved_sorting_key
type:                    Normal
total_rows:              1000
data_compressed_bytes:   8081
data_uncompressed_bytes: 12890
sorting_key:             ['user_id','date']
query:                   SELECT * ORDER BY user_id, date

Row 2:
──────
database:                default
table:                   landing
name:                    agg
type:                    Aggregate
total_rows:              2
data_compressed_bytes:   82
data_uncompressed_bytes: 32
sorting_key:             ['user_id']
query:                   SELECT user_id, max(date) AS max_date GROUP BY user_id