Thread: lifetime of TubleTableSlot* returned by ExecProcNode

lifetime of TubleTableSlot* returned by ExecProcNode

From
"Bramandia Ramadhana"
Date:
Hello,<br /><br />As per title, what is the lifetime of the virtual tuple TupleTableSlot* returned by ExecProcNode?<br
/><br/>Any help would be appreciated.<br /><br />Regards,<br /><br />Bramandia R.<br /><br /><span
class="HcCDpe"></span>

Re: lifetime of TubleTableSlot* returned by ExecProcNode

From
Tom Lane
Date:
"Bramandia Ramadhana" <bramandia@gmail.com> writes:
> As per title, what is the lifetime of the virtual tuple TupleTableSlot*
> returned by ExecProcNode?

Until you next call that same plan node.
        regards, tom lane


Re: lifetime of TubleTableSlot* returned by ExecProcNode

From
"Bramandia Ramadhana"
Date:
I see.
 
Hmm how if an upper level node needs to store (for future use) the TupleTableSlot* returned by lower level node, e.g. I create a specialized Sort Node which needs to read all tuples from lower level nodes. In this case, would it be necessary and sufficient to make a copy the TupleTableSlot ?
 
 
Regards,
 
Bramandia R.
 
On Fri, Dec 12, 2008 at 9:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Bramandia Ramadhana" <bramandia@gmail.com> writes:
> As per title, what is the lifetime of the virtual tuple TupleTableSlot*
> returned by ExecProcNode?

Until you next call that same plan node.

                       regards, tom lane

Re: lifetime of TubleTableSlot* returned by ExecProcNode

From
Tom Lane
Date:
"Bramandia Ramadhana" <bramandia@gmail.com> writes:
> Hmm how if an upper level node needs to store (for future use) the
> TupleTableSlot* returned by lower level node, e.g. I create a specialized
> Sort Node which needs to read all tuples from lower level nodes. In this
> case, would it be necessary and sufficient to make a copy the TupleTableSlot

It would be a pretty crummy way to approach it, because a Slot is not
intended to be a compact representation.  You probably want to use a
tuplestore or tuplesort object instead.
        regards, tom lane


Re: lifetime of TubleTableSlot* returned by ExecProcNode

From
"Bramandia Ramadhana"
Date:
I see. Thanks for the advice. I would research on how to use tuplestore object.
 
Regards,
 
Bramandia R.

On Sat, Dec 13, 2008 at 10:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Bramandia Ramadhana" <bramandia@gmail.com> writes:
> Hmm how if an upper level node needs to store (for future use) the
> TupleTableSlot* returned by lower level node, e.g. I create a specialized
> Sort Node which needs to read all tuples from lower level nodes. In this
> case, would it be necessary and sufficient to make a copy the TupleTableSlot

It would be a pretty crummy way to approach it, because a Slot is not
intended to be a compact representation.  You probably want to use a
tuplestore or tuplesort object instead.

                       regards, tom lane

Re: lifetime of TubleTableSlot* returned by ExecProcNode

From
"Bramandia Ramadhana"
Date:
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 />