You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
sr_plan looks like Oracle Outline system. It can be used to lock the execution plan. It is necessary if you do not trust the planner or able to form a better plan.
Build
Dependencies: >= Python 3.2, Mako, pycparserIf you only have a Python you can use the virtual environment:
make USE_PGXS=1 genparsermake USE_PGXS=1make USE_PGXS=1 install
and modify your postgres config:
shared_preload_libraries = 'sr_plan.so'
Usage
In your db:
CREATE EXTENSION sr_plan;
If you want to save the query plan is necessary to set the variable:
setsr_plan.write_mode= true;
Now plans for all subsequent queries will be stored in the table sr_plans. Don't forget that all queries will be stored including duplicates.Making an example query:
explain_jsonb_plan function allows you to display explain execute the plan of which lies in jsonb. By default, all the plans are off, you need enable it:
(1783086253 for example only)After that, the plan for the query will be taken from the sr_plans.
In addition sr plan allows you to save a parameterized query plan. In this case, we have some constants in the query are not essential.For the parameters we use a special function _p (anyelement) example: