加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在postgresql中解释(缓冲,分析)

发布时间:2020-12-13 16:00:24 所属栏目:百科 来源:网络整理
导读:我是 postgresql的新手,我试着理解 explain(缓冲区,分析)指令.我有一个查询,我使用explain(buffers,analyze)执行它. 第一次执行它时性能比第二次差.此外,第一次在’hit’旁边获得’read’参数,而第二次’read’不存在. 有人可以帮我理解吗? 解决方法 第一次
我是 postgresql的新手,我试着理解 explain(缓冲区,分析)指令.我有一个查询,我使用explain(buffers,analyze)执行它.

第一次执行它时性能比第二次差.此外,第一次在’hit’旁边获得’read’参数,而第二次’read’不存在.

有人可以帮我理解吗?

解决方法

第一次选择,页面变热 – 它们被加载到缓存,一旦它们在RAM中 – 所有下一个选择将更快(RAM速度更高).

因此缓冲区显示读取,当页面不在缓存中时,cos postgres读取它们,并且当它们变热时不读取,因此缓存被命中…

使用docs更新:

BUFFERS

Include information on buffer usage. Specifically,include the
number of shared blocks hit,read,dirtied,and written,the number of
local blocks hit,and the number of temp
blocks read and written. A hit means that a read was avoided because
the block was found already in cache when needed. Shared blocks
contain data from regular tables and indexes; local blocks contain
data from temporary tables and indexes; while temp blocks contain
short-term working data used in sorts,hashes,Materialize plan nodes,
and similar cases. The number of blocks dirtied indicates the number
of previously unmodified blocks that were changed by this query; while
the number of blocks written indicates the number of
previously-dirtied blocks evicted from cache by this backend during
query processing. The number of blocks shown for an upper-level node
includes those used by all its child nodes. In text format,only
non-zero values are printed. This parameter may only be used when
ANALYZE is also enabled. It defaults to FALSE.

令人惊讶的是缓冲区here并不多.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读