Question
How can I tell if a projection is used?Answer
- Create a sample database
- Create a sample table that will use column1 as the primary key
- Add a projection
for_column2to use column2 as the primary key
- Insert test data
- Check sample set of data
- Test that it is using the original table with column1:
db1.table1_projections
- Test reading from the projection by using column2 in the where clause
for_column2 projection is used.
For more info
Projections:
https://clickhouse.com/docs/sql-reference/statements/alter/projection
numbers table function:
https://clickhouse.com/docs/sql-reference/table-functions/numbers
Blog for generating random data:
https://clickhouse.com/blog/generating-random-test-distribution-data-for-clickhouse