Skip to content
Closed
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
1 change: 1 addition & 0 deletions data.generated.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions particledb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ParticleDB ClickBench Submission

[ParticleDB](https://particledb.ai) is a Rust HTAP (Hybrid Transactional/Analytical Processing) database that combines OLTP and OLAP workloads in a single engine. Source code is available at [github.com/particledb-ai](https://github.com/particledb-ai).

## Architecture

- **Storage format**: Apache Arrow columnar format with dictionary encoding for low-cardinality strings
- **Execution**: Columnar analytical engine with parallel query execution via Rayon thread pool
- **Type mapping**: All integers stored as BIGINT (i64), all strings as VARCHAR, TIMESTAMP as BIGINT (epoch seconds), DATE as VARCHAR ('YYYY-MM-DD')

## Key Optimizations for ClickBench

- **Zone-level precomputed aggregation**: Per-chunk SUM/COUNT/MIN/MAX stats resolve ungrouped aggregates in O(chunks) instead of O(rows). Tri-state filter classification (ALL/NONE/PARTIAL) skips entire chunks.
- **Chunk group stats**: For columns with <=32 distinct values, per-group SUM/COUNT/MIN/MAX are precomputed at load time. GROUP BY queries resolve from chunk summaries.
- **Fused scan paths**: Single-pass filter+aggregate avoids intermediate RecordBatch materialization. Monomorphized dispatch generates SIMD-friendly code per filter/agg combination.
- **Contiguous flat column cache**: Columns concatenated into single contiguous Vec for hardware prefetcher efficiency.
- **Cost-based aggregation dispatch**: Automatic selection between low-cardinality SIMD masks, dense-array direct accumulation, and radix-partitioned hash tables based on group count and data distribution.

## Hardware Requirements

- **c8g.metal-48xl** (192 vCPUs, 384 GB RAM) used for the submitted full 100M-row hits.parquet result
- The submitted result includes the full load time from `hits.parquet`

## Running

```bash
# Full automated setup on a fresh Ubuntu 24.04 VM
./benchmark.sh

# If already built and data is downloaded
./run.sh
```

## Data Loading

The benchmark loads all 100M rows from `hits.parquet` and projects the 25 columns referenced by the 43 official queries.

The included `create.sql` and `queries.sql` files are the official ClickBench SQL reference files. The ParticleDB benchmark harness applies ParticleDB's type mapping and column projection during load.

## Results Format

The test harness outputs ClickBench-compatible JSON with 3 runs per query:
```json
{
"system": "ParticleDB",
"result": [
[run1_seconds, run2_seconds, run3_seconds],
...
]
}
```
50 changes: 50 additions & 0 deletions particledb/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# ParticleDB ClickBench Benchmark
# Automated setup for a fresh Ubuntu 24.04 VM (tested on c8g.metal-48xl, 384GB RAM)

set -euo pipefail

# Install Rust
if ! command -v rustc &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
fi

# Install build dependencies
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev pkg-config

# Extract source (assumes particledb-src.tar.gz is in current directory)
Copy link
Copy Markdown
Member

@rschu1ze rschu1ze May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can I get particledb-src.tar.gz from to reproduce the submission? Asking because no such file is included in this PR and the homepage says the code is Apache 2.0 licensed but the linked ParticleDB GitHub repository only contains the website.

if [ ! -d "particledb" ]; then
mkdir -p particledb
tar xzf particledb-src.tar.gz -C particledb
fi
cd particledb

# Build in release mode
cargo build --release -p spanner-integration-tests

# Download ClickBench hits.parquet (14GB, ~100M rows)
mkdir -p benchmarks/clickbench/data
if [ ! -f "benchmarks/clickbench/data/hits.parquet" ]; then
wget -c 'https://datasets.clickhouse.com/hits_compatible/hits.parquet' \
-O benchmarks/clickbench/data/hits.parquet
fi

echo "============================================================"
echo " Running ParticleDB ClickBench (real hits.parquet)"
echo "============================================================"

# Run the benchmark (loads parquet, runs all 43 queries x 3 runs each)
CLICKBENCH_MACHINE="${CLICKBENCH_MACHINE:-c8g.metal-48xl}" \
cargo test -p spanner-integration-tests --release test_clickbench_real_hits -- --nocapture 2>&1 | tee /tmp/clickbench_results.log

# Extract key metrics
echo ""
echo "============================================================"
echo " Results Summary"
echo "============================================================"
grep 'CLICKBENCH_SUBMISSION_JSON_START' -A 100 /tmp/clickbench_results.log | \
sed -n '/^{/,/^}/p' > /tmp/clickbench_submission.json
echo "Submission JSON written to /tmp/clickbench_submission.json"
cat /tmp/clickbench_submission.json
108 changes: 108 additions & 0 deletions particledb/create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
CREATE TABLE hits (
WatchID BIGINT NOT NULL,
JavaEnable BIGINT NOT NULL,
Title VARCHAR NOT NULL,
GoodEvent BIGINT NOT NULL,
EventTime BIGINT NOT NULL,
EventDate VARCHAR NOT NULL,
CounterID BIGINT NOT NULL,
ClientIP BIGINT NOT NULL,
RegionID BIGINT NOT NULL,
UserID BIGINT NOT NULL,
CounterClass BIGINT NOT NULL,
OS BIGINT NOT NULL,
UserAgent BIGINT NOT NULL,
URL VARCHAR NOT NULL,
Referer VARCHAR NOT NULL,
IsRefresh BIGINT NOT NULL,
RefererCategoryID BIGINT NOT NULL,
RefererRegionID BIGINT NOT NULL,
URLCategoryID BIGINT NOT NULL,
URLRegionID BIGINT NOT NULL,
ResolutionWidth BIGINT NOT NULL,
ResolutionHeight BIGINT NOT NULL,
ResolutionDepth BIGINT NOT NULL,
FlashMajor BIGINT NOT NULL,
FlashMinor BIGINT NOT NULL,
FlashMinor2 VARCHAR NOT NULL,
NetMajor BIGINT NOT NULL,
NetMinor BIGINT NOT NULL,
UserAgentMajor BIGINT NOT NULL,
UserAgentMinor VARCHAR NOT NULL,
CookieEnable BIGINT NOT NULL,
JavascriptEnable BIGINT NOT NULL,
IsMobile BIGINT NOT NULL,
MobilePhone BIGINT NOT NULL,
MobilePhoneModel VARCHAR NOT NULL,
Params VARCHAR NOT NULL,
IPNetworkID BIGINT NOT NULL,
TraficSourceID BIGINT NOT NULL,
SearchEngineID BIGINT NOT NULL,
SearchPhrase VARCHAR NOT NULL,
AdvEngineID BIGINT NOT NULL,
IsArtifical BIGINT NOT NULL,
WindowClientWidth BIGINT NOT NULL,
WindowClientHeight BIGINT NOT NULL,
ClientTimeZone BIGINT NOT NULL,
ClientEventTime BIGINT NOT NULL,
SilverlightVersion1 BIGINT NOT NULL,
SilverlightVersion2 BIGINT NOT NULL,
SilverlightVersion3 BIGINT NOT NULL,
SilverlightVersion4 BIGINT NOT NULL,
PageCharset VARCHAR NOT NULL,
CodeVersion BIGINT NOT NULL,
IsLink BIGINT NOT NULL,
IsDownload BIGINT NOT NULL,
IsNotBounce BIGINT NOT NULL,
FUniqID BIGINT NOT NULL,
OriginalURL VARCHAR NOT NULL,
HID BIGINT NOT NULL,
IsOldCounter BIGINT NOT NULL,
IsEvent BIGINT NOT NULL,
IsParameter BIGINT NOT NULL,
DontCountHits BIGINT NOT NULL,
WithHash BIGINT NOT NULL,
HitColor VARCHAR NOT NULL,
LocalEventTime BIGINT NOT NULL,
Age BIGINT NOT NULL,
Sex BIGINT NOT NULL,
Income BIGINT NOT NULL,
Interests BIGINT NOT NULL,
Robotness BIGINT NOT NULL,
RemoteIP BIGINT NOT NULL,
WindowName BIGINT NOT NULL,
OpenerName BIGINT NOT NULL,
HistoryLength BIGINT NOT NULL,
BrowserLanguage VARCHAR NOT NULL,
BrowserCountry VARCHAR NOT NULL,
SocialNetwork VARCHAR NOT NULL,
SocialAction VARCHAR NOT NULL,
HTTPError BIGINT NOT NULL,
SendTiming BIGINT NOT NULL,
DNSTiming BIGINT NOT NULL,
ConnectTiming BIGINT NOT NULL,
ResponseStartTiming BIGINT NOT NULL,
ResponseEndTiming BIGINT NOT NULL,
FetchTiming BIGINT NOT NULL,
SocialSourceNetworkID BIGINT NOT NULL,
SocialSourcePage VARCHAR NOT NULL,
ParamPrice BIGINT NOT NULL,
ParamOrderID VARCHAR NOT NULL,
ParamCurrency VARCHAR NOT NULL,
ParamCurrencyID BIGINT NOT NULL,
OpenstatServiceName VARCHAR NOT NULL,
OpenstatCampaignID VARCHAR NOT NULL,
OpenstatAdID VARCHAR NOT NULL,
OpenstatSourceID VARCHAR NOT NULL,
UTMSource VARCHAR NOT NULL,
UTMMedium VARCHAR NOT NULL,
UTMCampaign VARCHAR NOT NULL,
UTMContent VARCHAR NOT NULL,
UTMTerm VARCHAR NOT NULL,
FromTag VARCHAR NOT NULL,
HasGCLID BIGINT NOT NULL,
RefererHash BIGINT NOT NULL,
URLHash BIGINT NOT NULL,
CLID BIGINT NOT NULL,
PRIMARY KEY (WatchID)
);
Loading