Coder Social home page Coder Social logo

pg_json_bench's Introduction

pg_json_bench

The goal of this project is to help to compare how different data types and indexes behaves with inserts and queries with json data.

After running the tests, pg_json_bench publishes the result to prometheus gateway and it is possible see the result on the prepared grafana dashboards.

Example of a dashboard generated by pg_json_bench Dashboard

Presentations

Running

Spin up docker compose with monitoring stack

docker compose up -d

Prepare the data

mkdir ./data
wget https://raw.githubusercontent.com/algolia/datasets/master/movies/records.json -O ./data/records.json

Prepare the schema

psql -c "create database test;"
psql -d test < ./main.sql

Build

go build -o pg_json_bench

Run Benchmark Example:

DBCONN="dbname=test sslmode=disable" ./pg_json_bench query count_score_over_7 btree_idx_score,gin_idx,gin_idx_path

On the output the link for the metrics will be displayed, maybe you need to refresh. Grafana user and password is admin

Available commands

insert

Example:

./pg_json_bench insert <comma separated list of tables to test>

query

Example:

./pg_json_bench query <query> <comma separated list of tables to test>

Available query options:

  • select_all
  • score_over_7
  • count_score_over_7
  • count_year_2000_at_gt
  • count_year_2000_eq

Tables

Available options:

  • text
  • json
  • jsonb
  • btree_idx_score
  • gin_idx
  • gin_idx_path

Note that the actual table name is prefixed with tbl_, so when text is passed as a parameter the table tbl_text will be used.

pg_json_bench's People

Contributors

waltton avatar franckpachot avatar dependabot[bot] avatar

Stargazers

Konstantin avatar Josh Innis avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.