pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
materialize
2+ messages / 2 participants
[nested] [flat]

* materialize
@ 2007-11-26 21:17  Ehab Galal <ehabgalal123@hotmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ehab Galal @ 2007-11-26 21:17 UTC (permalink / raw)
  To: pgsql-sql

Greetings,

I was wondering why do we need the Materialize node in the plan below when i explain a query? 


1: QUERY PLAN = "Nested Loop  (cost=10.99..24.34 rows=1 width=846)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----
1: QUERY PLAN = "      Join Filter: (("inner".cover)::text = ("outer".cover)::text)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----
1: QUERY PLAN = "      ->  Index Scan using idx_cover_ftn_ on c_cover_ftn  (cost=0.00..9.30 rows=2 width=86)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----
1: QUERY PLAN = "               Index Cond: (username = 'user1'::name)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----
1: QUERY PLAN = "      ->  Materialize  (cost=10.99..11.89 rows=90 width=842)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----
1: QUERY PLAN = "               ->  Seq Scan on books  (cost=0.00..10.90 rows=90 width=842)"    (typeid = 25, len = -1, typmod = -1, byval = f)
----


Thanks,
Ehab

_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline=

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: materialize
@ 2007-11-26 21:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Ehab Galal <ehabgalal123@hotmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2007-11-26 21:53 UTC (permalink / raw)
  To: Ehab Galal <ehabgalal123@hotmail.com>; +Cc: pgsql-sql

Ehab Galal <ehabgalal123@hotmail.com> writes:
> I was wondering why do we need the Materialize node in the plan below when i explain a query? 

It's cheaper to scan a materialized rowset many times than a raw table
--- we don't need to re-access shared memory nor re-check row visibility.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-11-26 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-26 21:17 materialize Ehab Galal <ehabgalal123@hotmail.com>
2007-11-26 21:53 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox