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: docs/managing-data/core-concepts/primary-indexes.md
+5-10
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ Each [data part](/parts) in the table has its own primary index. We can inspect
72
72
73
73
The following query lists the number of entries in the primary index for each data part of our example table:
74
74
75
-
```sql runnable=true
75
+
```sql
76
76
SELECT
77
77
part_name,
78
78
max(mark_number) as entries
@@ -82,7 +82,6 @@ GROUP BY part_name;
82
82
83
83
84
84
```txt
85
-
Static result for the query above from April 2025
86
85
┌─part_name─┬─entries─┐
87
86
1. │ all_2_2_0 │ 914 │
88
87
2. │ all_1_1_0 │ 1343 │
@@ -92,7 +91,7 @@ Static result for the query above from April 2025
92
91
93
92
This query shows the first 10 entries from the primary index of one of the current data parts. Note that these parts are continuously [merged](/merges) in the background into larger parts:
94
93
95
-
```sqlrunnable=true
94
+
```sql
96
95
SELECT
97
96
mark_number +1as entry,
98
97
town,
@@ -105,7 +104,6 @@ LIMIT 10;
105
104
106
105
107
106
```txt
108
-
Static result for the query above from April 2025
109
107
┌─entry─┬─town───────────┬─street───────────┐
110
108
1. │ 1 │ ABBOTS LANGLEY │ ABBEY DRIVE │
111
109
2. │ 2 │ ABERDARE │ RICHARDS TERRACE │
@@ -121,7 +119,7 @@ Static result for the query above from April 2025
121
119
```
122
120
123
121
Lastly, we use the [EXPLAIN](/sql-reference/statements/explain) clause to see how the primary indexes of all data parts are used to skip granules that can’t possibly contain rows matching the example query’s predicates. These granules are excluded from loading and processing:
@@ -155,15 +152,14 @@ Static result for the query above from April 2025
155
152
Note how row 13 of the EXPLAIN output above shows that only 3 out of 3,609 granules across all data parts were selected by the primary index analysis for processing. The remaining granules were skipped entirely.
156
153
157
154
We can also observe that most of the data was skipped by simply running the query:
158
-
```sqlrunnable=true
155
+
```sql
159
156
SELECTmax(price)
160
157
FROMuk.uk_price_paid_simple
161
158
WHERE (town ='LONDON') AND (street ='OXFORD STREET');
0 commit comments