Re: Difference between HeapTupleData and TupleTableSlot structures

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ajay P S <ajayps547(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Difference between HeapTupleData and TupleTableSlot structures
Date: 2022-10-08 02:58:06
Message-ID: 3461454.1665197886@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ajay P S <ajayps547(at)gmail(dot)com> writes:
> I am pretty new to the Postgres code base. I would like to know the
> difference between HeapTupleData and TupleTableSlot structures.

HeapTupleData is just a pointer to a concrete tuple. It exists
mainly because it's often convenient to pass around the tuple's
logical location (table OID and t_self) along with the tuple.
The comments about it in htup.h tell you about all you need to
know.

TupleTableSlot is a more abstract concept, being a container
for a tuple that can be present in several different forms.
It can contain a concrete tuple (HeapTupleData), or a "virtual"
tuple that is just an array of Datum+isnull values. The executor
usually uses tuple slots to return tuples out of plan nodes;
they're not very common elsewhere.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-10-08 04:55:50 Re: use has_privs_of_role() for pg_hba.conf
Previous Message Andres Freund 2022-10-08 02:56:33 Re: START_REPLICATION SLOT causing a crash in an assert build