Skip to main content

query-plan-optimizer

Postgresql Statistics are vital for a good query plan. This library finds tables with large number of live tuples and tries to find related models with foreign key to the model and sets statistics for the field on destination model.

Installation

$ pip install psql-stat-optimizer

add psql_optimizer to your INSTALLED_APPS

usage:

Using full optimize command:

$ ./manage.py optimize_statistics

Valid Parameters:

  • set_all: if passed as True it sets for all founded models automatically
  • analyze_all: if passed as True it analyzes all models after their statistics is changed
  • live_tup_count: the minimum number of n_live_tup to consider as a big table. default is 100000
  • statistics: the statistics value you want to set to. default is 10000

Using statistics command:

$ ./manage.py set_statistics

Parameters:

  • table: the target table name
  • column: the target column
  • statistics: the target statistics

TODO:

  • remove time.sleep which is used for printing
  • add command for analyze a table manually

Metadata

Release files for psql-stat-optimizer 0.0.45

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for psql-stat-optimizer 0.0.45
File Interpreter ABI Platform
psql_stat_optimizer-0.0.45-py3-none-any.whl Python 3 none any Details

Release files / psql_stat_optimizer-0.0.45-py3-none-any.whl

Download URL psql_stat_optimizer-0.0.45-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03f0b12799a4596a0eec20a8b446ca0a44011d68532010f091f38b2366e8ee11
BLAKE2b-256 checksum
How to use checksums
1d5f91833c654058cbcb7e0bac82fa124f0fc23420a37e99f0f5fa3569849fa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.0.45 This release

1 release file

0.0.44

1 release file

0.0.43

1 release file

0.0.42

1 release file

0.0.41

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page