Pure Java 25 · Zero Dependencies

Query any file.
Instantly.

AdhocDB is an analytical SQL engine built from scratch. No config. No cluster. No external dependencies. Just point it at your data and go.

adhocdb — ~/data
$ java -jar adhocdb.jar hits.tsv
Loading hits.tsv... 1,000,000 rows in 2.4s
AdhocDB ready. Type SQL or 'help'.

adhocdb▸ SELECT RegionID, COUNT(*) AS hits
FROM hits
GROUP BY RegionID
ORDER BY hits DESC
LIMIT 5;

┌──────────┬─────────┐
│ RegionID │ hits │
├──────────┼─────────┤
│ 229 │ 174,013 │
│ 2 │ 52,823 │
│ 208 │ 34,189 │
│ 1 │ 25,422 │
│ 34 │ 18,711 │
└──────────┴─────────┘
5 rows · 48ms

adhocdb▸
0
External dependencies
~6K
Lines of pure Java
1M+
Rows per second
<3s
From file to first query
Everything you need.
Nothing you don't.
Built for the developer who's tired of spinning up Postgres just to look at a CSV.

Columnar Storage

Data stored column-by-column for maximum analytical query performance. Scans only the columns you need.

🧠

Hand-Written Parser

Custom recursive-descent SQL parser. No ANTLR, no Calcite, no generated code. Every token parsed with intent.

📊

Full SQL Support

SELECT, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET, DISTINCT, subqueries, and aggregate functions.

🌐

Web UI Included

Built-in HTTP server with a beautiful query editor. Schema explorer, syntax highlighting, autocomplete. Zero setup.

🖥️

Interactive CLI

Full REPL with tab completion, SQL syntax highlighting, and formatted table output. Powered by JLine.

🔬

EXPLAIN Plans

Understand exactly what the engine does. Step-by-step execution plans for every query.

Pure Java 25

Uses the latest Java features: sealed interfaces, records, pattern matching. Runs on any JVM.

📦

Single JAR

One fat JAR. No Docker. No cluster. No config files. Download, run, query.

🏆

ClickBench Tested

Validated against the industry-standard ClickBench analytical benchmark. Real queries, real data.

Three commands. That's it.
From zero to querying a million rows in under 30 seconds.
01

Build

Clone and build with Gradle. Java 25 required.

git clone https://github.com/PakhomovAlexander/adhoc-db-live
cd adhoc-db-live
./gradlew jar
02

Load

Point it at any TSV file. It loads and indexes automatically.

java -jar build/libs/adhoc-db-live.jar data.tsv
03

Query

Write SQL. Get answers. It's that simple.

SELECT COUNT(*), AVG(duration)
FROM events
WHERE status = 'error'
GROUP BY region;
Built from first principles.
Every layer written from scratch. No frameworks, no shortcuts, no magic.
SQL Input
Lexer → Parser → AST
Query Executor + Expression Evaluator
Columnar Storage Engine
  • 🔤

    Hand-Written Lexer

    Character-by-character tokenization. Handles SQL keywords, identifiers, strings, numbers, and operators with zero dependencies.

  • 🌳

    Recursive Descent Parser

    Produces a clean AST using Java sealed interfaces and records. Pattern matching for exhaustive type handling.

  • ⚙️

    Vectorized Execution

    Row filtering, group-by partitioning, and aggregate computation operate directly on column arrays for cache-friendly access.

  • 💾

    Columnar Storage

    Each column stored as a typed Java array. Only touched columns are read during query execution. Minimal memory overhead.

Fast enough to be useful.
ClickBench queries on 1M rows. No pre-computation, no indexes, no cheating.
Query Description Time Relative
Q1 COUNT(*) 2ms
Q6 GROUP BY with COUNT + ORDER BY 38ms
Q12 WHERE + GROUP BY + HAVING + ORDER BY 125ms
Q23 Multi-column GROUP BY + complex WHERE 210ms
Q35 Full analytical: nested aggregates + LIKE 340ms

Stop configuring.
Start querying.

Open source. Free forever. Built by a developer, for developers.

git clone → ./gradlew jar