幫幫忙頂一下這個文章,非常好的一個文章,非常值得了解。
來自:http://blog.chinaunix.net/uid-24774106-id-3780341.html
PostgreSQL部署上之后,經過一段時間的運行,我們比較關心那些SQL運行時間比較長,或者說那些SQL執行的特別慢,拖累的性能,只有找到這些SQL,才能有針對性地對這些SQL進行優化,提升PostgreSQL的性能。 PostgreSQL提供了pg_stat_statements來存儲SQL的運行次數,總運行時間,shared_buffer命中次數,shared_buffer read次數等統計信息。
Name | Type | References | Description |
---|---|---|---|
userid | oid | pg_authid.oid | OID of user who executed the statement |
dbid | oid | pg_database.oid | OID of database in which the statement was executed |
query | text | Text of the statement (up to track_activity_query_size bytes) | |
calls | bigint | Number of times executed | |
total_time | double PRecision | Total time spent in the statement, in seconds | |
rows | bigint | Total number of rows retrieved or affected by the statement | |
shared_blks_hit | bigint | Total number of shared blocks hits by the statement | |
shared_blks_read | bigint | Total number of shared blocks reads by the statement | |
shared_blks_written | bigint | Total number of shared blocks writes by the statement | |
local_blks_hit | bigint | Total number of local blocks hits by the statement | |
local_blks_read | bigint | Total number of local blocks reads by the statement | |
local_blks_written | bigint | Total number of local blocks writes by the statement | |
temp_blks_read | bigint | Total number of temp blocks reads by the statement | |
temp_blks_written | bigint | Total number of temp blocks writes by the statemen |
新聞熱點
疑難解答