lifetime of TubleTableSlot* returned by ExecProcNode

Started by Bramandia Ramadhanaabout 17 years ago6 messages
#1Bramandia Ramadhana
bramandia@gmail.com

Hello,

As per title, what is the lifetime of the virtual tuple TupleTableSlot*
returned by ExecProcNode?

Any help would be appreciated.

Regards,

Bramandia R.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bramandia Ramadhana (#1)
Re: lifetime of TubleTableSlot* returned by ExecProcNode

"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

#3Bramandia Ramadhana
bramandia@gmail.com
In reply to: Tom Lane (#2)
Re: lifetime of TubleTableSlot* returned by ExecProcNode

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:

Show quoted text

"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

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bramandia Ramadhana (#3)
Re: lifetime of TubleTableSlot* returned by ExecProcNode

"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

#5Bramandia Ramadhana
bramandia@gmail.com
In reply to: Tom Lane (#4)
Re: lifetime of TubleTableSlot* returned by ExecProcNode

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:

Show quoted text

"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

#6Bramandia Ramadhana
bramandia@gmail.com
In reply to: Tom Lane (#4)
Re: lifetime of TubleTableSlot* returned by ExecProcNode

After reading the source code for nodeHash.c and tuplesort.c, I decided to
create new struct containing MinimumTuple and few members.

I am still wondering in one thing:
typedef struct HashJoinTupleData
{
struct HashJoinTupleData *next; /* link to next tuple in same
bucket */
uint32 hashvalue; /* tuple's hash code */
/* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */
} HashJoinTupleData;

typedef struct
{
void *tuple; /* the tuple proper */
Datum datum1; /* value of first key column */
bool isnull1; /* is first key column NULL? */
int tupindex; /* see notes above */
} SortTuple;

In HashJoinTupleData, the MinimalTupleData is appended at the end of the
struct whereas in SortTuple, a pointer to MinimalTupleData is stored in
tuple member.
What are the reasons for the difference? And when does one approach is more
preferable than another?

Regards,

Bramandia R.

On Sat, Dec 13, 2008 at 10:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

"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