Skip to main content

SQL query optimization hints

Project description

## Introduction This API will help you optimize your sql queries for better performance.

## Workflow

### Create the optimizer object Object specific to a single (query, schema) pair e.g. optimizer = Optimizer(query, schema)

### Get optimization hints using optimize_query() Output: optimization hints

Usage: optimizer.optimize_query()

Initial Optimization Checks
  • Using approximate algorithms (approx_distinct() instead of COUNT(DISTINCT …))

  • Selecting the columns the user wants explicitly, rather than using (SELECT *)

  • Filtering on partitioned columns

  • Try to extract nested subqueries using a WITH clause.

Other Stuff
  • Eliminate date_parse overhead

  • Replace UNION with UNION ALL if duplicates do not need to be removed

  • Aggregate a series of LIKE clauses into one regexp_like expression

  • Push down a complex join condition into a sub query

  • Specify GROUP BY targets with numbers for expressions

### Testing To run unit tests, run py.test (or py.test -s to see stdout) in the tests directory.

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

user-query-optimizer-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file user-query-optimizer-0.1.1.tar.gz.

File metadata

File hashes

Hashes for user-query-optimizer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00fb66e99a7b5f0f48f1a8ce1fed4bafd145ebbe9358fa9b834a6807c44e8861
MD5 3fbabf82cf53dd870eda67131f1f1a55
BLAKE2b-256 2273c5d81d12ebf241f5a1ddb76bf181efdf686a71355266db212188913374e8

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