Skip to content

Commit

Permalink
Update projections-examples.md
Browse files Browse the repository at this point in the history
examples to 3rd level
  • Loading branch information
BorisTyshkevich authored Sep 20, 2024
1 parent 25a331a commit 4ae2b09
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ Since 24.7, we also have a setting to control the behavior w.r.t. lightweight de

- system.projection_parts
- system.projection_parts_columns

## Aggregating projections

## Examples

### Aggregating projections

```sql
create table z(Browser String, Country UInt8, F Float64)
Expand Down Expand Up @@ -114,7 +116,7 @@ group by Browser,Country format Null;
Elapsed: 0.005 sec. Processed 22.43 thousand rows
```

## Emulation of an inverted index using orderby projection
### Emulation of an inverted index using orderby projection

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.

Expand Down

0 comments on commit 4ae2b09

Please sign in to comment.