Skip to content

PERF-6348 port tpcc postgress jsonb #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d598e75
first draft
miguelangelnieto Jan 13, 2025
7fc0b02
retry and corrected results
miguelangelnieto Jan 15, 2025
10bfd62
remove comment
miguelangelnieto Jan 15, 2025
aa01a9c
add a warning about the isolation level
miguelangelnieto Jan 16, 2025
6ba6d60
change some info to debug
miguelangelnieto Jan 16, 2025
1247794
Add Postgres JSONB support
blagoev Mar 18, 2025
544cb12
add documentation for Postgres JSONB
blagoev Mar 18, 2025
7bc2c19
fix docs
blagoev Mar 18, 2025
fba0137
fix
blagoev Mar 18, 2025
3ee833a
fix readme
blagoev Mar 18, 2025
e21fd09
fix bugs when accesing row data by index
blagoev Mar 18, 2025
27846d4
fix a bug in updateBCCustomer JSONB query
blagoev Mar 21, 2025
e25eb05
fix unique constraint error when creating New Orders.
blagoev Apr 10, 2025
2c024de
fix loader hanging when operaiton is multiple hours long
blagoev Apr 15, 2025
914ad66
fix jsonb schema, indexes and queries, add commented debug logging to…
blagoev Apr 24, 2025
5ae1a14
comment debug printing from doDelivery
blagoev Apr 24, 2025
53f70b6
Merge branch 'blagoev/PERF-6348-port-tpcc-postgress-jsonb' of https:/…
blagoev Apr 24, 2025
56342fe
comment debug prints
blagoev Apr 24, 2025
f82eb63
check the query result before access
blagoev Apr 24, 2025
c671342
support isolation level setting
blagoev Jun 16, 2025
b51493f
support isolation level setting
blagoev Jun 16, 2025
90dd46d
remove debug left overs
blagoev Jun 16, 2025
ab2515d
remove debug left overs
blagoev Jun 16, 2025
96c8b3e
rename tpcc.ssql to postgresql.sql and revert tpcc.sql to production …
blagoev Jun 16, 2025
9806094
fully revert tpcc.sql file to production branch version
blagoev Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug MongoDB driver",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
//"args": "${command:pickArgs}"
"args": "--reset --clients=1 --duration=1 --scalefactor=2000 --warehouses=1 --config=mongodb.config mongodb --stop-on-error",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
},
{
"name": "Debug Postgresql JSONB driver",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
"args": "--reset --clients=1 --duration=1 --scalefactor=2000 --warehouses=1 --ddl tpcc_jsonb.sql --config=postgresqljsonb.config postgresqljsonb",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
},
{
// To debug doDelivery, doOrderStatus, doPayment, doStockLevel, getNumberWH
"name": "Debug Postgresql JSONB driver No RESET No LOAD",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
"args": "--no-load --clients=4 --duration=10 --warehouses=1 --ddl tpcc_jsonb.sql --config=postgresqljsonb.config postgresqljsonb",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
},
{
"name": "Debug Postgresql JSONB driver Perf",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
"args": "--reset --clients=1 --duration=1 --scalefactor=20 --warehouses=1 --ddl tpcc_jsonb.sql --config=postgresqljsonb.config postgresqljsonb",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
},
{
"name": "Debug Postgresql driver",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
//"args": "${command:pickArgs}"
"args": "--reset --clients=1 --duration=1 --scalefactor=2000 --warehouses=1 --config=postgresql.config postgresql",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
},
{
"name": "Debug Postgresql driver No RESET No LOAD",
"type": "debugpy",
"request": "launch",
"program": "tpcc.py",
"console": "integratedTerminal",
//"args": "${command:pickArgs}"
"args": "--no-load --clients=1 --duration=1 --scalefactor=2000 --warehouses=1 --config=postgresql.config postgresql",
"cwd": "${workspaceFolder}/pytpcc/",
"python": "/home/linuka/python_envs/py-tpcc-env/bin/python"
}

]
}
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,76 @@ The structure of the repo is:
All the tests were run using [MongoDB Atlas](https://www.mongodb.com/cloud/atlas?jmp=VLDB2019).
Use code `VLDB2019` to get $150 credit to get started with MongoDB Atlas.


## Postgres JSONB Driver

This branch contains a Postgres JSONB Driver.

Steps to run the PostgreSQL JSONB Driver

1. Start Postgres.

```bash
sudo systemctl start postgresql
```

2. Create ana activate a python env.

```bash
mkdir ~/python_envs
cd ~/python_envs
~/python_envs$ python -m venv py-tpcc-env
source ~/python_envs/py-tpcc-env/bin/activate
```

3. Print your config.

```bash
cd ~/py-tpcc/pytpcc
~/py-tpcc/pytpcc$ python ./tpcc.py --print-config postgresqljsonb > postgresqljsonb.config
```

3. Edit the configuraiton for Postgres in the postgresqljsonb.config. Add a password.

```bash
# PostgresqljsonbDriver Configuration File
# Created 2025-03-18 23:00:45.340852
[postgresqljsonb]

# The name of the PostgreSQL database
database = tpcc

# The host address of the PostgreSQL server
host = localhost

# The port number of the PostgreSQL server
port = 5432

# The username to connect to the PostgreSQL database
user = postgres

# The password to connect to the PostgreSQL database
password = <ADD_PASSWORD_HERE>
```

4. Run the PostgreSQL JSONB driver tests with resetting the database.

```bash
~/py-tpcc/pytpcc$ python ./tpcc.py --reset --clients=1 --duration=1 --warehouses=1 --ddl tpcc_jsonb.sql --config=postgresqljsonb.config postgresqljsonb --stop-on-error
```

5. Run the PostgreSQL JSONB driver tests with no load phase to use the data that is already loaded in the Postgres database.

```bash
~/py-tpcc/pytpcc$ python ./tpcc.py --no-load --clients=1 --duration=1 --warehouses=1 --ddl tpcc_jsonb.sql --config=postgresqljsonb.config postgresqljsonb --stop-on-error
```

6. If you need to connect to Postgres and check the database size

```bash
psql -U postgres # and type the password
postgres=# \l+

# For any SQL command first use the database
\c tpcc;
```
2 changes: 1 addition & 1 deletion pytpcc/drivers/mongodbdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from pprint import pformat
from time import sleep
import pymongo
from pymongo.client_session import TransactionOptions

import constants
from .abstractdriver import AbstractDriver
Expand Down Expand Up @@ -407,7 +408,6 @@ def loadTuples(self, tableName, tuples):
for t in tuples:
tuple_dicts.append(dict([(columns[i], t[i]) for i in num_columns]))
## FOR

self.database[tableName].insert_many(tuple_dicts)
## IF

Expand Down
Loading