Skip to content

miare-ir/psql-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published