https://github.com/d0k1/pgear
A poor man's PostgreSQL load generator
https://github.com/d0k1/pgear
load-testing postgresql stress-testing
Last synced: 4 months ago
JSON representation
A poor man's PostgreSQL load generator
- Host: GitHub
- URL: https://github.com/d0k1/pgear
- Owner: d0k1
- Created: 2018-09-19T05:28:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-01T10:26:05.000Z (almost 7 years ago)
- Last Synced: 2025-08-16T01:38:28.261Z (5 months ago)
- Topics: load-testing, postgresql, stress-testing
- Language: Groovy
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PG Extract And Replay
_A poor man's PostgreSQL load generator_
_plain and simple_
## Prerequisites
To tune / profile / stress(load) test a particular postgresql instance you need a postgresql log with queries. The most convinient way to get it is to configure postgresql instance to log every query that executes longer that 2 seconds (it's just an example)
## Step 0
```
groovy Extract.groovy postgresql-Fri.log postgresql.sql
```
This command will parse postgesql's log and will generate a file with queries. Most important point of this is that in the end you will have a list of queries that are ready to be execute on same postgresql instance. Queries will have paramters in their places.
## Step 1
```
groovy Replay.groovy jdbc:postgresql://localhost:5432/ login password postgresql.sql
```
This command will execute queries saved to postgresql.sql in a multithreaded way. As a result you will get a result.csv in current directory with information about queries execution.
## Step 2
You can gather descriptive statistic via your favourite tool or you can use Histrogram.groovy
## Step 3
After `Step 2` you'll have result.csv file. Every line of that file will contain a query id and it's execution time. But due to multithreaded execution order of queries in a result.csv usually doesn't correspond to postgresql.sql queries order. So to find what is a query with id 32 for example you could use a `QueryIndex.groovy`