PostgreSQL の、プランナーにおける Materialize ノードについて
Published: 2022/4/9
EXPLAIN
などをした時に、プランナーにより表示される実行ノードのうち、 Materialize ノードがどのようにふるまうかについてのメモ。
https://www.postgresql.org/docs/current/using-explain.html
上記ページより抜粋して、
Notice that here the planner has chosen to "materialize" the inner relation of the join, by putting a Materialize plan node atop it. This means that the t2 index scan will be done just once, even though the nested-loop join node needs to read that data ten times, once for each row from the outer relation. The Materialize node saves the data in memory as it's read, and then returns the data from memory on each subsequent pass.
であるので、 Materialize ノードは、取得したレコードをメモリ上に補完しておき、それをループごとに再利用することができるノードであることが読み取れる。 また、
In a PostgreSQL query plan, what is the difference between Materialize and Hash?
Here's an example of a query plan with Materialize: Nested Loop (cost=4.65..49.46 rows=33 width=488) Join Filter: (t1.hundred < t2.hundred) -> ... (outer) -> Materialize (cos...
stackoverflow.com

によれば、 materizalize におけるデータは、レコードのタプルがそのままメモリに配列みたいな形で保管されていることが、ソースコードから読み取れる、とのこと。
Tags: postgresql
関連記事
PostgreSQL の Incremental Sorting について
2021/12/22
ARIES と fuzzy check pointing
2021/6/1
PostgreSQL サーバーで ident を利用してパスワードレスに
2020/1/23