Skip to main content

Library to profile and compare SQL queries for different databases.

Project description

BlueScope

Introduce science to SQL optimization.

Description

Profiles the performance of SQL queries by running the N times and measuring the time it takes to execute with minimizing any external reasons such as compilation time, queue time e.t.c.

How many times SQL query will be run is determined by confidence level and margin of error.

Compares results of 2 different queries using Student's t-test. Returns the result of the test (p-value) and the conclusion.

Table of currently supported databases:

Data Base Current status
Redshift Serverless Supported ✅
Redshift Dedicated In development ⏳
BigQuery Planned
PostgreSQL Planned
MySQL Planned

How to use

CLI

CLI is in development. For now, you can use the package in your code.

Package

To install package run pip install bluescope

To use the package in your code:

from bluescope import REDSHIFT_SERVERLESS
from bluescope import get_profiler
from bluescope.statsutils import find_significance

profiler_rs_cls = get_profiler(REDSHIFT_SERVERLESS)
profiler_rs = profiler_cls(host=*host*, port=*port*,
                           db=*db*, user=*user*,
                           password=*password*, agree=True)

pr_1 = profiler_rs.profile(*query_1*)
pr_2 = profiler_rs.profile(*query_2*)

p = find_significance(pr_1['mean'], pr_2['mean'],
                      pr_1['std'], pr_2['std'],
                      pr_1['sample_size'], pr_2['sample_size'])

How to contribute

Any ideas, comments, code improvements are very welcome.

To contribute to the project, please follow the steps:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Push your changes to your branch
  5. Create a pull request
  6. Wait for the review

License

⚖️ GPL-3.0

Contact

Maintainer: Mirzabekian Arkadii 📧 Email

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BlueScope-1.0.0b1.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

BlueScope-1.0.0b1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file BlueScope-1.0.0b1.tar.gz.

File metadata

  • Download URL: BlueScope-1.0.0b1.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for BlueScope-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 f81f2c4d4c48723ec97fdd3266ca586797e3a78851722cdf7359a163929dd1ba
MD5 d939537518b9a6d987ea4577dac36c13
BLAKE2b-256 bd85b257451b7b85753fbe23a245687bee1458848e68b4a5ef7e9395fd03d42a

See more details on using hashes here.

File details

Details for the file BlueScope-1.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: BlueScope-1.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for BlueScope-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 11fc1a215d13ea5ddf9c16be7e81b6a5431c15d0d13edc30b9d09f08b8de274c
MD5 c60151bf09a1bde74f8c5976050dc613
BLAKE2b-256 ea707de4629d32ef1d0f7fb1b2e24a275c6ebb99734520021da7680e555df129

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page