Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa296c2

Browse files
committed
fix docs
1 parent062b032 commitaa296c2

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#Save and restore query plans in PostgreSQL
22

3+
##Rationale
4+
5+
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.
6+
37
##Build
48

59
Dependencies: >= Python 3.2, Mako, pycparser
@@ -31,7 +35,7 @@ If you want to save the query plan is necessary to set the variable:
3135
```SQL
3236
setsr_plan.write_mode= true;
3337
```
34-
Now plans for all subsequentrequests will be stored in the table sr_plans.It must be rememberedthat allrequests will bemaintained including duplicates.
38+
Now plans for all subsequentqueries will be stored in the table sr_plans.Don't forgetthat allqueries will bestored including duplicates.
3539
Making an example query:
3640
```SQL
3741
select query_hashfrom sr_planswhere query_hash=10;
@@ -43,12 +47,22 @@ set sr_plan.write_mode = false;
4347
Now verify that your query is saved:
4448
```SQL
4549
select query_hash, enable, valid, query, explain_jsonb_plan(plan)from sr_plans;
50+
51+
query_hash | enable | valid | query | explain_jsonb_plan
52+
------------+--------+-------+------------------------------------------------------+----------------------------------------------------
53+
1783086253 | f | t |select query_hashfrom sr_planswhere query_hash=10; | Bitmap Heap Scanon sr_plans+
54+
| | | | Recheck Cond: (query_hash=10)+
55+
| | | |-> Bitmap Index Scanon sr_plans_query_hash_idx+
56+
| | | | Index Cond: (query_hash=10)+
57+
| | | |
58+
4659
```
60+
4761
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:
4862
```SQL
49-
update sr_plansset enable=truewhere query_hash=812619660;
63+
update sr_plansset enable=truewhere query_hash=1783086253;
5064
```
51-
(812619660 for example only)
65+
(1783086253 for example only)
5266
After that, the plan for the query will be taken from the sr_plans.
5367

5468
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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp