You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/altinity-kb-queries-and-syntax/projections-examples.md
+12-12
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,14 @@
1
1
---
2
-
title: "Projections"
3
-
linkTitle: "Projections"
2
+
title: "ClickHouse® Projections"
3
+
linkTitle: "ClickHouse Projections"
4
4
description: >
5
-
Projections
5
+
Using this ClickHouse feature to optimize queries
6
+
keywords:
7
+
- clickhouse projections
8
+
- clickhouse projection vs materialized view
6
9
---
7
10
8
-
Projections in ClickHouse act as inner tables within a main table, functioning as a mechanism to optimize queries by using these inner tables when only specific columns are needed. Essentially, a projection is similar to a Materialized View with an AggregatingMergeTree engine, designed to be automatically populated with relevant data.
11
+
Projections in ClickHouse act as inner tables within a main table, functioning as a mechanism to optimize queries by using these inner tables when only specific columns are needed. Essentially, a projection is similar to a [Materialized View](/altinity-kb-schema-design/materialized-views/) with an [AggregatingMergeTree engine](/engines/mergetree-table-engine-family/aggregatingmergetree/), designed to be automatically populated with relevant data.
9
12
10
13
However, too many projections can lead to excess storage, much like overusing Materialized Views. Projections share the same lifecycle as the main table, meaning they are automatically backfilled and don’t require query rewrites, which is particularly advantageous when integrating with BI tools.
11
14
@@ -20,7 +23,7 @@ Projection parts are stored within the main table parts, and their merges occur
20
23
* Blog video https://clickhouse.com/videos/how-to-a-clickhouse-query-using-projections
21
24
22
25
23
-
## Why is a projection not used?
26
+
## Why is a ClickHouse projection not used?
24
27
25
28
A query analyzer should have a reason for using projection.
What happens in the case of non-trivial background merges in ReplacingMergeTree, AggregatingMergeTree and similar, and OPTIMIZE table DEDUPLICATE queries?
76
79
77
-
Before version 24.8, projections became out of sync with the main data.
78
-
79
-
Since version 24.8, it is controlled by a new table-level setting:
* Before version 24.8, projections became out of sync with the main data.
81
+
* Since version 24.8, it is controlled by a new table-level setting:<br/>[deduplicate_merge_projection_mode](https://clickhouse.com/docs/en/operations/settings/merge-tree-settings#deduplicate_merge_projection_mode) = `throw`/`drop`/`rebuild`
82
82
83
83
However, projection usage is still disabled for FINAL queries. So, you have to use OPTIMIZE FINAL or SELECT ...GROUP BY instead of FINAL for fighting duplicates between parts
84
84
@@ -165,7 +165,7 @@ where create_table_query ilike '%projection%'
165
165
166
166
## Examples
167
167
168
-
### Aggregating projections
168
+
### Aggregating ClickHouse projections
169
169
170
170
```sql
171
171
createtablez(Browser String, Country UInt8, F Float64)
### Emulation of an inverted index using orderby projection
226
226
227
-
You can create an `orderby projection` and include all columns of a table, but if a table is very wide it will double of stored data. This example demonstrate a trick, we create an `orderby projection` and include primary key columns and the target column and sort by the target column. This allows using subquery to find [primary key values](../../engines/mergetree-table-engine-family/pick-keys/) and after that to query the table using the primary key.
227
+
You can create an `orderby projection` and include all columns of a table, but if a table is very wide it will double the amount of stored data. This example demonstrate a trick, we create an `orderby projection` and include primary key columns and the target column and sort by the target column. This allows using subquery to find [primary key values](../../engines/mergetree-table-engine-family/pick-keys/) and after that to query the table using the primary key.
Copy file name to clipboardExpand all lines: content/en/altinity-kb-queries-and-syntax/ttl/modify-ttl.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,12 @@
1
1
---
2
-
title: "MODIFY (ADD) TTL"
2
+
title: "MODIFY (ADD) TTL in ClickHouse®"
3
3
linkTitle: "MODIFY (ADD) TTL"
4
4
weight: 100
5
5
description: >-
6
-
What happens during a MODIFY or ADD TTL query.
6
+
What happens during a MODIFY or ADD TTL query
7
+
keywords:
8
+
- clickhouse modify ttl
9
+
- clickhouse alter table ttl
7
10
---
8
11
9
12
*For a general overview of TTL, see the article [Putting Things Where They Belong Using New TTL Moves](https://altinity.com/blog/2020-3-23-putting-things-where-they-belong-using-new-ttl-moves).*
Copy file name to clipboardExpand all lines: content/en/altinity-kb-setup-and-maintenance/altinity-kb-monitoring.md
+13-14
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,15 @@
2
2
title: "ClickHouse® Monitoring"
3
3
linkTitle: "ClickHouse® Monitoring"
4
4
description: >
5
-
ClickHouse® Monitoring
5
+
Tracking potential issues in your cluster before they cause a critical error
6
+
keywords:
7
+
- clickhouse monitoring
8
+
- clickhouse metrics
6
9
---
7
10
8
-
## ClickHouse® Monitoring
9
-
10
-
Monitoring helps to track potential issues in your cluster before they cause a critical error.
11
-
12
-
What to read / watch on subject:
13
-
* Altinity webinar "ClickHouse Monitoring 101: What to monitor and how". [recording](https://www.youtube.com/watch?v=W9KlehhgwLw), [slides](https://www.slideshare.net/Altinity/clickhouse-monitoring-101-what-to-monitor-and-how)
* Altinity webinar "ClickHouse Monitoring 101: What to monitor and how". [Watch the video](https://www.youtube.com/watch?v=W9KlehhgwLw) or [download the slides](https://www.slideshare.net/Altinity/clickhouse-monitoring-101-what-to-monitor-and-how).
ClickHouse allow to access lot of internals using system tables. The main tables to access monitoring data are:
103
+
ClickHouse allows to access lots of internals using system tables. The main tables to access monitoring data are:
105
104
* system.metrics
106
105
* system.asynchronous_metrics
107
106
* system.events
@@ -310,13 +309,13 @@ The following queries are recommended to be included in monitoring:
310
309
*`SELECT * FROM system.mutations`
311
310
* This is the source of information on the speed and progress of currently executed merges.
312
311
313
-
## Logs monitoring
312
+
## Monitoring ClickHouse logs
314
313
315
-
ClickHouse logs can be another important source of information. There are 2 logs enabled by default
314
+
[ClickHouse logs](/altinity-kb-setup-and-maintenance/logging/) can be another important source of information. There are 2 logs enabled by default
316
315
* /var/log/clickhouse-server/clickhouse-server.err.log (error & warning, you may want to keep an eye on that or send it to some monitoring system)
317
316
* /var/log/clickhouse-server/clickhouse-server.log (trace logs, very detailed, useful for debugging, usually too verbose to monitor).
318
317
319
-
You can additionally enable system.text_log table to have an access to the logs from clickhouse sql queries (ensure that you will not expose some information to the users which should not see it).
318
+
You can additionally enable system.text_log table to have an access to the logs from clickhouse sql queries (ensure that you will not expose some information to the users who should not see it).
0 commit comments