Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions benchmarks/queries/clickbench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Results look like
```

### Q6: How many social shares meet complex multi-stage filtering criteria?

**Question**: What is the count of sharing actions from iPhone mobile users on specific social networks, within common timezones, participating in seasonal campaigns, with high screen resolutions and closely matched UTM parameters?
**Important Query Properties**: Simple filter with high-selectivity, Costly string matching, A large number of filters with high overhead are positioned relatively later in the process

Expand Down Expand Up @@ -159,6 +160,37 @@ WHERE
```
Result is empty,Since it has already been filtered by `"SocialAction" = 'share'`.

### Q7: Device Resolution and Refresh Behavior Analysis

**Question**: Identify the top 10 WatchIDs with the highest resolution range (min/max "ResolutionWidth") and total refresh count ("IsRefresh") in descending WatchID order

**Important Query Properties**: Primitive aggregation functions, group by single primitive column, high cardinality grouping

```sql
SELECT "WatchID", MIN("ResolutionWidth") as wmin, MAX("ResolutionWidth") as wmax, SUM("IsRefresh") as srefresh
FROM hits
GROUP BY "WatchID"
ORDER BY "WatchID" DESC
LIMIT 10;
```

Results look like
```
+---------------------+------+------+----------+
| WatchID | wmin | wmax | srefresh |
+---------------------+------+------+----------+
| 9223372033328793741 | 1368 | 1368 | 0 |
| 9223371941779979288 | 1479 | 1479 | 0 |
| 9223371906781104763 | 1638 | 1638 | 0 |
| 9223371803397398692 | 1990 | 1990 | 0 |
| 9223371799215233959 | 1638 | 1638 | 0 |
| 9223371785975219972 | 0 | 0 | 0 |
| 9223371776706839366 | 1368 | 1368 | 0 |
| 9223371740707848038 | 1750 | 1750 | 0 |
| 9223371715190479830 | 1368 | 1368 | 0 |
| 9223371620124912624 | 1828 | 1828 | 0 |
+---------------------+------+------+----------+
```

## Data Notes

Expand Down
1 change: 1 addition & 0 deletions benchmarks/queries/clickbench/extended.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ SELECT "SocialSourceNetworkID", "RegionID", COUNT(*), AVG("Age"), AVG("ParamPric
SELECT "ClientIP", "WatchID", COUNT(*) c, MIN("ResponseStartTiming") tmin, MEDIAN("ResponseStartTiming") tmed, MAX("ResponseStartTiming") tmax FROM hits WHERE "JavaEnable" = 0 GROUP BY "ClientIP", "WatchID" HAVING c > 1 ORDER BY tmed DESC LIMIT 10;
SELECT "ClientIP", "WatchID", COUNT(*) c, MIN("ResponseStartTiming") tmin, APPROX_PERCENTILE_CONT(0.95) WITHIN GROUP (ORDER BY "ResponseStartTiming") tp95, MAX("ResponseStartTiming") tmax FROM 'hits' WHERE "JavaEnable" = 0 GROUP BY "ClientIP", "WatchID" HAVING c > 1 ORDER BY tp95 DESC LIMIT 10;
SELECT COUNT(*) AS ShareCount FROM hits WHERE "IsMobile" = 1 AND "MobilePhoneModel" LIKE 'iPhone%' AND "SocialAction" = 'share' AND "SocialSourceNetworkID" IN (5, 12) AND "ClientTimeZone" BETWEEN -5 AND 5 AND regexp_match("Referer", '\/campaign\/(spring|summer)_promo') IS NOT NULL AND CASE WHEN split_part(split_part("URL", 'resolution=', 2), '&', 1) ~ '^\d+$' THEN split_part(split_part("URL", 'resolution=', 2), '&', 1)::INT ELSE 0 END > 1920 AND levenshtein(CAST("UTMSource" AS STRING), CAST("UTMCampaign" AS STRING)) < 3;
SELECT "WatchID", MIN("ResolutionWidth") as wmin, MAX("ResolutionWidth") as wmax, SUM("IsRefresh") as srefresh FROM hits GROUP BY "WatchID" ORDER BY "WatchID" DESC LIMIT 10;