struct RelOptInfo member relid comments

Started by jian healmost 2 years ago6 messageshackers
Jump to latest
#1jian he
jian.universality@gmail.com

hi

typedef struct RelOptInfo
{
....
/*
* information about a base rel (not set for join rels!)
*/
Index relid;
...
}

imho, the above comment is not very helpful.
we should say more about what kind of information relid says about a base rel?

I don't know much about RelOptInfo, that's why I ask.

#2Tender Wang
tndrwang@gmail.com
In reply to: jian he (#1)
Re: struct RelOptInfo member relid comments

jian he <jian.universality@gmail.com> 于2024年5月24日周五 10:58写道:

hi

typedef struct RelOptInfo
{
....
/*
* information about a base rel (not set for join rels!)
*/
Index relid;
...
}

imho, the above comment is not very helpful.
we should say more about what kind of information relid says about a base
rel?

I don't know much about RelOptInfo, that's why I ask.

The fields in struct RelOptInfo between comment " information about a base

rel " and
commnet "Information about foreign tables and foreign joins" are all about
a base rel.

Every field has a comment. I think that's already helpful for understanding
what information
we need to optimize a base rel.
--
Tender Wang
OpenPie: https://en.openpie.com/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: jian he (#1)
Re: struct RelOptInfo member relid comments

jian he <jian.universality@gmail.com> writes:

imho, the above comment is not very helpful.
we should say more about what kind of information relid says about a base rel?

"Relid" is defined at the very top of the file:

/*
* Relids
* Set of relation identifiers (indexes into the rangetable).
*/
typedef Bitmapset *Relids;

Repeating that everyplace the term "relid" appears would not be
tremendously helpful.

regards, tom lane

#4jian he
jian.universality@gmail.com
In reply to: Tom Lane (#3)
Re: struct RelOptInfo member relid comments

On Fri, May 24, 2024 at 11:14 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

jian he <jian.universality@gmail.com> writes:

imho, the above comment is not very helpful.
we should say more about what kind of information relid says about a base rel?

"Relid" is defined at the very top of the file:

/*
* Relids
* Set of relation identifiers (indexes into the rangetable).
*/
typedef Bitmapset *Relids;

Repeating that everyplace the term "relid" appears would not be
tremendously helpful.

`Index relid;`
is a relation identifier, a base rel's rangetable index.

Does the above description make sense?

BTW, I found several occurrences of "base+OJ", but I cannot find the
explanation of "OJ" or the "OJ" Acronyms.

#5Ashutosh Bapat
ashutosh.bapat@enterprisedb.com
In reply to: jian he (#4)
Re: struct RelOptInfo member relid comments

On Fri, May 24, 2024 at 9:09 AM jian he <jian.universality@gmail.com> wrote:

On Fri, May 24, 2024 at 11:14 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

jian he <jian.universality@gmail.com> writes:

imho, the above comment is not very helpful.
we should say more about what kind of information relid says about a

base rel?

"Relid" is defined at the very top of the file:

/*
* Relids
* Set of relation identifiers (indexes into the

rangetable).

*/
typedef Bitmapset *Relids;

Repeating that everyplace the term "relid" appears would not be
tremendously helpful.

`Index relid;`
is a relation identifier, a base rel's rangetable index.

Does the above description make sense?

BTW, I found several occurrences of "base+OJ", but I cannot find the
explanation of "OJ" or the "OJ" Acronyms.

OJ is an outer join, AFAIU. OJ's have their own relids. If you are

wondering why not all joins - I think inner joins need not be tracked as
separated relations in parse tree, but OJ's need to be.

--
Best Wishes,
Ashutosh Bapat

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ashutosh Bapat (#5)
Re: struct RelOptInfo member relid comments

Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> writes:

OJ is an outer join, AFAIU. OJ's have their own relids. If you are
wondering why not all joins - I think inner joins need not be tracked as
separated relations in parse tree, but OJ's need to be.

An outer join is necessarily associated with explicit JOIN syntax
in the FROM clause, and each such JOIN has its own rangetable entry
and hence a relid. Inner joins might arise from comma syntax
(that is, "SELECT ... FROM tab1, tab2"). For perhaps-historical
reasons that syntax doesn't give rise to an explicit RTE_JOIN
rangetable entry, so the implied join has no relid.

regards, tom lane