Materialized¶
Materialized views speed up request to resource “/lists/linkkeys” on method POST.
To use materialized views, it needs:
After database creation(using db_create.py) check next values: USE_MATERIAL_VIEWS - 1 in config, and MATERIAL_VIEW_REFRESH_RATE - 25(default) in ./base_scripts/mv_create.py or another refresh rate that it needs to use (recommended not using refresh rate less than 5 seconds)
Launch materialize views’ creation script:
python ./base_scripts/mv_create.py
If script was executed without errors, all views were created successfully.
If service using postgres database copy pg_refresh.service to /etc/systemd/system folder, and execute
systemctl daemon-reload && systemctl start pg_refresh.serviceMaterialized views setup complete
To update materialized views’ refresh rate:
Update MATERIAL_VIEW_REFRESH_RATE in mv_create.py
If service using postgres database, execute
systemctl start pg_refresh.serviceIf service using oracle database, execute
python ./base_scripts/mv_create.py
Update materialized views complete. Now, service can be restarted.
To test materialized views, execute:
Duplicate value of MATERIAL_VIEW_REFRESH_RATE from service config to tests’ config to the same variable
Execute:
python -m unittest tests.unittests_mvAll tests should perform successfully.