SQL解释计划:什么是实现? [英] SQL explain plan: what is Materialize?
问题描述
我要求PostgreSQL解释我的查询。部分解释是:
I asked PostgreSQL to explain my query. Part of the explanation was:
table_name --> Materialize
实现是什么?我要加入两个表,而不是视图或类似的表。
What does materialize do? I'm joining two tables, not views or anything like that.
推荐答案
实例化节点表示树中其下方任何内容的输出(可以是扫描或完整的输出)在执行上层节点之前,将连接数或类似的内容进行矩阵化处理。通常,当外部节点需要出于某种原因可以重新扫描的源时,就可以这样做。
A materialize node means the output of whatever is below it in the tree (which can be a scan, or a full set of joins or something like that) is materalized into memory before the upper node is executed. This is usually done when the outer node needs a source that it can re-scan for some reason or other.
因此,在您的情况下,计划者确定结果是对您的一张表进行一次扫描将适合存储在内存中,直到可以选择需要重新扫描而又更便宜的上层联接操作为止。
So in your case, the planner is determining that the result of a scan on one of your tables will fit in memory, and it till make it possible to choose an upper join operation that requires rescans while still being cheaper.
这篇关于SQL解释计划:什么是实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!