Skip to content

Commit 062b032

Browse files
committed
Update README.md
1 parent 35d8331 commit 062b032

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,22 @@ set sr_plan.write_mode = false;
4242
```
4343
Now verify that your query is saved:
4444
```SQL
45-
select query_hash, enable, query, explain_jsonb_plan(plan) from sr_plans;
45+
select query_hash, enable, valid, query, explain_jsonb_plan(plan) from sr_plans;
4646
```
4747
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:
4848
```SQL
4949
update sr_plans set enable=true where query_hash=812619660;
5050
```
5151
(812619660 for example only)
5252
After that, the plan for the query will be taken from the sr_plans.
53+
54+
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.
55+
For the parameters we use a special function _p (anyelement) example:
56+
```SQL
57+
select query_hash from sr_plans where query_hash=1000+_p(10);
58+
```
59+
if we keep the plan for the query and enable it to be used also for the following queries:
60+
```SQL
61+
select query_hash from sr_plans where query_hash=1000+_p(11);
62+
select query_hash from sr_plans where query_hash=1000+_p(-5);
63+
```

0 commit comments

Comments
 (0)