Install Apache Arrow Flight SQL PostgreSQL adapter.
Run PostgreSQL with the following configuration:
shared_preload_libraries = 'arrow_flight_sql'
Run the benchmark script:
benchmark/run.shIt runs all benchmarks and outputs their results to
benchmark/${BENCHMARK}/result.csv.
You can visualize them:
benchmark/graph.rbIt generates benchmark/${BENCHMARK}/result.svg.
You can format them as Markdown:
benchmark/markdown.rbIt replaces benchmark results in benchmark/${BENCHMARK}/README.md.
Each sub directory have a shell script that outputs preparation
SQL. For example, you can use benchmark/integer/prepare-sql.sh for
integer benchmark:
benchmark/integer/prepare-sql.sh 1000000 afs_benchmark | psql -d postgresIt creates afs_benchmark database and data table in the database.
It also inserts 1000000 (1M) records with random integers to the
table.
You can use the following programs to measure each approach:
select.rb: It uses Apache Arrow Flight SQLselect-adbc-flight-sql.rb: It uses Apache Arrow Flight SQL via ADBCselect-adbc-postgresql.rb: It uses PostgreSQL protocol via ADBCselect-pandas.py: It uses pandasselect-polars.py: It uses Polarsselect: It uses PostgreSQL's C APIselect.sql: You need to usepsqlto run thiscopy: It usesCOPYand PostgreSQL's C API
All of them just run SELECT * FROM data.