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

Commit7bb3c33

Browse files
committed
README.md updated to reflect recent changes
1 parent7118ea2 commit7bb3c33

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

‎README.md‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,40 @@ Add module name to the `shared_preload_libraries` parameter in `postgresql.conf`
2626
shared_preload_libraries = 'pg_query_state'
2727
```
2828
It is essential to restart the PostgreSQL instance. After that, execute the following query in psql:
29-
```
29+
```sql
3030
CREATE EXTENSION pg_query_state;
3131
```
3232
Done!
3333

3434
##Tests
35-
Tests using parallel sessionsusing python 2.7 script:
36-
```
37-
python tests/pg_qs_test_runner.py [OPTION]...
38-
```
35+
Test using parallel sessionswith Python 2.7/3+ compatible script:
36+
```shell
37+
python tests/pg_qs_test_runner.py [OPTION]...
38+
```
3939
*prerequisite packages*:
4040
*`psycopg2` version 2.6 or later
4141
*`PyYAML` version 3.11 or later
42-
42+
*`progressbar2` for stress test progress reporting
43+
4344
*options*:
4445
**- -host* --- postgres server host, default value is*localhost*
4546
**- -port* --- postgres server port, default value is*5432*
4647
**- -database* --- database name, default value is*postgres*
4748
**- -user* --- user name, default value is*postgres*
4849
**- -password* --- user's password, default value is empty
4950

51+
Or run all tests in`Docker` using:
52+
53+
```shell
54+
export LEVEL=stress
55+
export PG_VERSION=12
56+
57+
docker-compose build
58+
docker-compose run tests
59+
```
60+
61+
There are different test levels:`hardcore`,`nightmare` (runs tests under`valgrind`) and`stress` (runs tests under`TPC-DS` load).
62+
5063
##Function pg\_query\_state
5164
```plpgsql
5265
pg_query_state(integer pid,
@@ -92,11 +105,11 @@ This parameters is set on called side before running any queries whose states ar
92105

93106
##Examples
94107
Set maximum number of parallel workers on`gather` node equals`2`:
95-
```
108+
```sql
96109
postgres=# set max_parallel_workers_per_gather = 2;
97110
```
98111
Assume one backend with pid = 49265 performs a simple query:
99-
```
112+
```sql
100113
postgres=# select pg_backend_pid();
101114
pg_backend_pid
102115
----------------
@@ -105,7 +118,7 @@ postgres=# select pg_backend_pid();
105118
postgres=# select count(*) from foo join bar on foo.c1=bar.c1;
106119
```
107120
Other backend can extract intermediate state of execution that query:
108-
```
121+
```sql
109122
postgres=# \x
110123
postgres=# select * from pg_query_state(49265);
111124
-[ RECORD1 ]+-------------------------------------------------------------------------------------------------------------------------
@@ -150,11 +163,11 @@ In example above working backend spawns two parallel workers with pids `49324` a
150163
`Seq Scan` node has statistics on passed loops (average number of rows delivered to`Nested Loop` and number of passed loops are shown) and statistics on current loop. Other nodes has statistics only for current loop as this loop is first (`loop number` = 1).
151164

152165
Assume first backend executes some function:
153-
```
166+
```sql
154167
postgres=# select n_join_foo_bar();
155168
```
156169
Other backend can get the follow output:
157-
```
170+
```sql
158171
postgres=# select * from pg_query_state(49265);
159172
-[ RECORD1 ]+------------------------------------------------------------------------------------------------------------------
160173
pid |49265
@@ -180,7 +193,7 @@ leader_pid | (null)
180193
First row corresponds to function call, second - to query which is in the body of that function.
181194

182195
We can get result plans in different format (e.g.`json`):
183-
```
196+
```sql
184197
postgres=# select * from pg_query_state(pid := 49265, format := 'json');
185198
-[ RECORD1 ]+------------------------------------------------------------
186199
pid |49265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp