Skip to content

Rumman90/database-performance-lab

Repository files navigation

Database Performance Lab

Database performance lab for PostgreSQL, MySQL, SQL Server, and Oracle.

The repo runs the same simplified fintech schema on four database engines. The queries are intentionally similar so execution plans can be compared without changing the business problem each time.

The interesting part is not the final timing by itself. The plan tells you when a query changes from a scan to a seek, when an index is ignored, when a sort disappears, or when two engines make different choices for the same query shape.

Databases

  • PostgreSQL 16
  • MySQL 8
  • SQL Server 2022
  • Oracle Database Free 23c

Schema

The schema is based on a small digital wallet and payments system.

Tables

  • users
  • wallets
  • beneficiaries
  • merchants
  • payments
  • transactions
  • ledger_entries
  • audit_logs

Queries

Wallet Balance Lookup

Point lookup by wallet number.

Transaction History

Recent transactions for a customer wallet.

Merchant Payment Reporting

Successful payment totals grouped by merchant.

Daily Transaction Volume

Transaction count and amount grouped by day.

Ledger Reconciliation

Transaction amounts compared with ledger entries.

Audit Log Search

Recent audit events filtered by entity and action.

Repository Structure

database-performance-lab/

├── postgresql/
├── mysql/
├── sqlserver/
├── oracle/
├── docs/
├── diagrams/
└── docker-compose.yml

Getting Started

Start Containers

docker compose up -d

Verify Containers

docker ps

Connect With A SQL Client

Default ports:

Database Port
PostgreSQL 5432
MySQL 3306
SQL Server 1433
Oracle 1521

The credentials are defined in docker-compose.yml.

Test Process

  1. Load schema
  2. Load sample data
  3. Run the query before adding indexes
  4. Capture execution plans
  5. Apply indexes
  6. Refresh database statistics
  7. Run the same query again
  8. Compare results

What This Covers

  • Query Execution Plans
  • Indexing Strategies
  • Optimizer Statistics
  • Join Performance
  • Aggregation Performance
  • Date Range Queries
  • Audit Log Searches
  • Fintech Query Patterns

Documentation

License

This project is licensed under the MIT License.

See the LICENSE file for details.

About

Compare how PostgreSQL, MySQL, SQL Server, and Oracle run the same database queries with and without indexes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors