Re: lifetime of TubleTableSlot* returned by ExecProcNode
От | Bramandia Ramadhana |
---|---|
Тема | Re: lifetime of TubleTableSlot* returned by ExecProcNode |
Дата | |
Msg-id | 700260640812152145j507a2f4ejb63838207a29c1cc@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: lifetime of TubleTableSlot* returned by ExecProcNode (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
After reading the source code for nodeHash.c and tuplesort.c, I decided to create new struct containing MinimumTuple andfew members.<br /><br />I am still wondering in one thing:<br />typedef struct HashJoinTupleData<br />{<br /> structHashJoinTupleData *next; /* link to next tuple in same bucket */<br /> uint32 hashvalue; /*tuple's hash code */<br /> /* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */<br />} HashJoinTupleData;<br/><br />typedef struct<br />{<br /> void *tuple; /* the tuple proper */<br /> Datum datum1; /* value of first key column */<br /> bool isnull1; /* is first key columnNULL? */<br /> int tupindex; /* see notes above */<br />} SortTuple;<br /><br />In HashJoinTupleData,the MinimalTupleData is appended at the end of the struct whereas in SortTuple, a pointer to MinimalTupleDatais stored in tuple member.<br /> What are the reasons for the difference? And when does one approach is morepreferable than another?<br /><br />Regards,<br /><br />Bramandia R.<br /><br /><br /><div class="gmail_quote">On Sat,Dec 13, 2008 at 10:36 AM, Tom Lane <span dir="ltr"><<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>></span>wrote:<br /><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">"BramandiaRamadhana" <<a href="mailto:bramandia@gmail.com">bramandia@gmail.com</a>> writes:<br /></div><divclass="Ih2E3d">> Hmm how if an upper level node needs to store (for future use) the<br /> > TupleTableSlot*returned by lower level node, e.g. I create a specialized<br /> > Sort Node which needs to read all tuplesfrom lower level nodes. In this<br /> > case, would it be necessary and sufficient to make a copy the TupleTableSlot<br/><br /></div>It would be a pretty crummy way to approach it, because a Slot is not<br /> intended to bea compact representation. You probably want to use a<br /> tuplestore or tuplesort object instead.<br /><br /> regards, tom lane<br /></blockquote></div><br />
В списке pgsql-hackers по дате отправления: