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.sh
It runs all benchmarks and outputs their results to benchmark/${BENCHMARK}/result.csv.
You can visualize them:
benchmark/graph.rb
It generates benchmark/${BENCHMARK}/result.svg.
You can format them as Markdown:
benchmark/markdown.rb
It 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 postgres
It 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 use psql to run thiscopy: It uses COPY and PostgreSQL's C APIAll of them just run SELECT * FROM data.