This application benchmarks MySQL query performance using DuckDB and Parquet files with Golang.
-
Query performance in MySQL:
- Executes a query directly on the MySQL database and measures execution time.
- Generates a Parquet file with the query results.
-
Query performance in Parquet files using DuckDB:
- Reads the Parquet file generated from MySQL data and executes SQL queries on it using DuckDB.
- Install Go (v1.23.3 or higher): Download here.
- Install DuckDB (optional for external verification): Download here.
- Have access to a MySQL database.
-
Clone the repository:
-
Install the dependencies:
go mod tidy
go run main.go
If you want to build the application, put the .env file in the same directory as the binary file.
For Windows:
GOOS=windows GOARCH=amd64 go build -o out/benchmark-mysql.exe main.go
For Linux:
GOOS=linux GOARCH=amd64 go build -o out/benchmark-mysql main.go
For MacOS:
GOOS=darwin GOARCH=amd64 go build -o out/benchmark-mysql main.go
Duckdb is five times faster than MySQL for the same query.
Parquet files are a good compression format for data storage and can be used to improve query performance. 116235 rows where stored in a 2.881MB file.