Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Makefile
Readme.md
bench.sql
hstore_trigger_setup.sql
jsonb_minus_2_setup.sql
jsonb_minus_setup.sql
keys2_trigger_setup.sql
keys_trigger_setup.sql

Readme.md

Triggers benchmarks

This benchmark uses standard pg_bench table pgbench_accounts. We consider several approaches for calculating records diff: one uses hstore extension, two uses jsonb functions and two others iterate through record fields.

Usage

Create database:

make setup

You can provide database name by DB variable (defaults to "logidze_bench").

Run all benchmarks:

make

or separate benchmark:

make hstore

make jsonb

make jsonb2

make keys

make keys2

# Raw update, no triggers
make plain

You can specify the number of transactions by T variable (defaults to 10000):

make T=1000000

Results

The benchmark shows that hstore variant is the most efficient (running on MacPro 2013, 2.4 GHz Core i5, 4GB, SSD, 1 million transactions per test):

Mode TPS Statement latency (ms)
plain 3628 0.113
hstore 3015 0.168
jsonb 1647 0.363
jsonb2 1674 0.354
keys 2355 0.219
keys2 2542 0.210

Logidze uses hstore variant.