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.
$ pip install psql-stat-optimizer
add psql_optimizer
to your INSTALLED_APPS
$ ./manage.py optimize_statistics
- 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
$ ./manage.py set_statistics
- table: the target table name
- column: the target column
- statistics: the target statistics
- remove time.sleep which is used for printing
- add command for analyze a table manually