Skip to content

Commit b5017eb

Browse files
digoal zhoudigoal zhou
authored andcommitted
new doc
1 parent 082fcab commit b5017eb

File tree

5 files changed

+241
-0
lines changed

5 files changed

+241
-0
lines changed

202012/20201217_01.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## PostgreSQL 性能 dashboard 产品 - PgHero
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2020-12-17
8+
9+
### 标签
10+
PostgreSQL , dashboard , pgHero
11+
12+
----
13+
14+
## 背景
15+
https://pghero.dokkuapp.com/
16+
17+
https://github.com/ankane/pghero
18+
19+
# PgHero
20+
21+
A performance dashboard for Postgres
22+
23+
[See it in action](https://pghero.dokkuapp.com/)
24+
25+
[![Screenshot](https://pghero.dokkuapp.com/assets/pghero-a09d6c90d3d5cbf90f437b792a9b0c89751054c5e10be57af4efb79feab2458b.png)](https://pghero.dokkuapp.com/)
26+
27+
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
28+
29+
[![Build Status](https://github.com/ankane/pghero/workflows/build/badge.svg?branch=master)](https://github.com/ankane/pghero/actions) [![Docker Pulls](https://img.shields.io/docker/pulls/ankane/pghero)](https://hub.docker.com/repository/docker/ankane/pghero)
30+
31+
## Installation
32+
33+
PgHero is available as a Docker image, Linux package, and Rails engine.
34+
35+
Select your preferred method of installation to get started.
36+
37+
- [Docker](guides/Docker.md)
38+
- [Linux](guides/Linux.md)
39+
- [Rails](guides/Rails.md)
40+
41+
## Related Projects
42+
43+
- [Dexter](https://github.com/ankane/dexter) - The automatic indexer for Postgres
44+
- [PgBouncerHero](https://github.com/kwent/pgbouncerhero) - A dashboard for PgBouncer
45+
- [pgsync](https://github.com/ankane/pgsync) - Sync Postgres data between databases
46+
- [pgslice](https://github.com/ankane/pgslice) - Postgres partitioning as easy as pie
47+
48+
## Credits
49+
50+
A big thanks to [Craig Kerstiens](http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/) and [Heroku](https://blog.heroku.com/archives/2013/5/10/more_insight_into_your_database_with_pgextras) for the initial queries and [Bootswatch](https://github.com/thomaspark/bootswatch) for the theme.
51+
52+
## History
53+
54+
View the [changelog](https://github.com/ankane/pghero/blob/master/CHANGELOG.md)
55+
56+
## Contributing
57+
58+
Everyone is encouraged to help improve this project. Here are a few ways you can help:
59+
60+
- [Report bugs](https://github.com/ankane/pghero/issues)
61+
- Fix bugs and [submit pull requests](https://github.com/ankane/pghero/pulls)
62+
- Write, clarify, or fix documentation
63+
- Suggest or add new features
64+
65+
66+
67+
#### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
68+
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216").
69+
70+
71+
#### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea")
72+
73+
74+
#### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8")
75+
76+
77+
#### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
78+
79+
80+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
81+

202012/20201217_02.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
## PostgreSQL explain analyze 火山图 图形化软件 pg_flame
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2020-12-17
8+
9+
### 标签
10+
PostgreSQL , pg_flame , explain , 火山图
11+
12+
----
13+
14+
## 背景
15+
https://github.com/mgartner/pg_flame
16+
17+
![pic](20201217_02_pic_001.png)
18+
19+
demo
20+
21+
https://mgartner.github.io/pg_flame/flamegraph.html
22+
23+
# pg_flame [![Version](https://img.shields.io/badge/version-v1.1-blue.svg)](https://github.com/mgartner/pg_flame/releases) [![Build Status](https://travis-ci.com/mgartner/pg_flame.svg?branch=master)](https://travis-ci.com/mgartner/pg_flame)
24+
25+
A flamegraph generator for Postgres `EXPLAIN ANALYZE` output.
26+
27+
<a href="https://mgartner.github.io/pg_flame/flamegraph.html">
28+
<img width="700" src="https://user-images.githubusercontent.com/1128750/67738754-16f0c300-f9cd-11e9-8fc2-6acc6f288841.png">
29+
</a>
30+
31+
## Demo
32+
33+
Try the demo [here](https://mgartner.github.io/pg_flame/flamegraph.html).
34+
35+
## Installation
36+
37+
### Homebrew
38+
39+
You can install via Homebrew with the follow command:
40+
41+
```
42+
$ brew install mgartner/tap/pg_flame
43+
```
44+
45+
### Download pre-compiled binary
46+
47+
Download one of the compiled binaries [in the releases
48+
tab](https://github.com/mgartner/pg_flame/releases). Once downloaded, move
49+
`pg_flame` into your `$PATH`.
50+
51+
### Docker
52+
53+
Alternatively, if you'd like to use Docker to build the program, you can.
54+
55+
```
56+
$ docker pull mgartner/pg_flame
57+
```
58+
59+
### Build from source
60+
61+
If you'd like to build a binary from the source code, run the following
62+
commands. Note that compiling requires Go version 1.13+.
63+
64+
```
65+
$ git clone https://github.com/mgartner/pg_flame.git
66+
$ cd pg_flame
67+
$ go build
68+
```
69+
70+
A `pg_flame` binary will be created that you can place in your `$PATH`.
71+
72+
## Usage
73+
74+
The `pg_flame` program reads a JSON query plan from standard input and writes
75+
the flamegraph HTML to standard ouput. Therefore you can pipe and direct input
76+
and output however you desire.
77+
78+
### Example: One-step
79+
80+
```bash
81+
$ psql dbname -qAtc 'EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT id FROM users' \
82+
| pg_flame \
83+
> flamegraph.html \
84+
&& open flamegraph.html
85+
```
86+
87+
### Example: Multi-step with SQL file
88+
89+
Create a SQL file with the `EXPLAIN ANALYZE` query.
90+
91+
```sql
92+
-- query.sql
93+
EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
94+
SELECT id
95+
FROM users
96+
```
97+
98+
Then run the query and save the JSON to a file.
99+
100+
```bash
101+
$ psql dbname -qAtf query.sql > plan.json
102+
```
103+
104+
Finally, generate the flamegraph HTML.
105+
106+
```
107+
$ cat plan.json | pg_flame > flamegraph.html
108+
```
109+
110+
### Example: Docker
111+
112+
If you've followed the Docker installation steps above, you can pipe query plan
113+
JSON to a container and save the output HTML.
114+
115+
```
116+
$ psql dbname -qAtc 'EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT id FROM users' \
117+
| docker run -i pg_flame \
118+
> flamegraph.html
119+
```
120+
121+
## Background
122+
123+
[Flamegraphs](http://www.brendangregg.com/flamegraphs.html) were invented by
124+
Brendan Gregg to visualize CPU consumption per code-path of profiled software.
125+
They are useful visualization tools in many types of performance
126+
investigations. Flamegraphs have been used to visualize Oracle database
127+
[query
128+
plans](https://blog.tanelpoder.com/posts/visualizing-sql-plan-execution-time-with-flamegraphs/)
129+
and [query
130+
executions](https://externaltable.blogspot.com/2014/05/flame-graphs-for-oracle.html)
131+
, proving useful for debugging slow database queries.
132+
133+
Pg_flame is in extension of that work for Postgres query plans. It generates a
134+
visual hierarchy of query plans. This visualization identifies the relative
135+
time of each part of a query plan.
136+
137+
This tool relies on the
138+
[`spiermar/d3-flame-graph`](https://github.com/spiermar/d3-flame-graph) plugin to
139+
generate the flamegraph.
140+
141+
142+
#### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
143+
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216").
144+
145+
146+
#### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea")
147+
148+
149+
#### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8")
150+
151+
152+
#### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
153+
154+
155+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
156+

202012/20201217_02_pic_001.png

153 KB
Loading

202012/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### 文章列表
44
----
5+
##### 20201217_02.md [《PostgreSQL explain analyze 火山图 图形化软件 pg_flame》](20201217_02.md)
6+
##### 20201217_01.md [《PostgreSQL 性能 dashboard 产品 - PgHero》](20201217_01.md)
57
##### 20201216_02.md [《PostgreSQL 13 新增开发者GUC参数backtrace_functions, 配置跟踪C函数列表. 源码开发调试增强.》](20201216_02.md)
68
##### 20201216_01.md [《PostgreSQL 收费列存储插件 - Swarm64》](20201216_01.md)
79
##### 20201215_03.md [《企业级SaaS行业投资人视角》](20201215_03.md)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ digoal's|PostgreSQL|文章|归类
7878

7979
### 所有文档如下
8080
----
81+
##### 202012/20201217_02.md [《PostgreSQL explain analyze 火山图 图形化软件 pg_flame》](202012/20201217_02.md)
82+
##### 202012/20201217_01.md [《PostgreSQL 性能 dashboard 产品 - PgHero》](202012/20201217_01.md)
8183
##### 202012/20201216_02.md [《PostgreSQL 13 新增开发者GUC参数backtrace_functions, 配置跟踪C函数列表. 源码开发调试增强.》](202012/20201216_02.md)
8284
##### 202012/20201216_01.md [《PostgreSQL 收费列存储插件 - Swarm64》](202012/20201216_01.md)
8385
##### 202012/20201215_03.md [《企业级SaaS行业投资人视角》](202012/20201215_03.md)

0 commit comments

Comments
 (0)