Обсуждение: What do these terms mean in the SOURCE CODE?

Поиск
Список
Период
Сортировка

What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:
I am going through the Executor code and come across the following terms quite often. Can someone tell me what do they
mean(in a few (may be a couple of) sentences)?<br /><br />1. Scan State<br />2. Plan State<br />3. Tuple Projection<br
/>4. EState<br />5. Qual<br />6. Expression<br /><br />They sound quite ambiguous in the source code, specially when
someof them already have terms which have multiple meanings. <br /><br />Thanks for your time. <br /><br />-Vaibhav
(*_*)<br/> 

Fwd: What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:
<br />Is no one ready to help on this? :(<br /><br />-Vaibhav <br /><div class="gmail_quote">---------- Forwarded
message----------<br />From: <b class="gmail_sendername">Vaibhav Kaushal</b> <span dir="ltr"><<a
href="mailto:vaibhavkaushal123@gmail.com">vaibhavkaushal123@gmail.com</a>></span><br/> Date: Fri, Nov 19, 2010 at
9:11PM<br />Subject: What do these terms mean in the SOURCE CODE?<br />To: <a
href="mailto:pgsql-hackers@postgresql.org">pgsql-hackers@postgresql.org</a><br/><br /><br />I am going through the
Executorcode and come across the following terms quite often. Can someone tell me what do they mean (in a few (may be a
coupleof) sentences)?<br /><br />1. Scan State<br />2. Plan State<br />3. Tuple Projection<br /> 4. EState<br />5.
Qual<br/>6. Expression<br /><br />They sound quite ambiguous in the source code, specially when some of them already
haveterms which have multiple meanings. <br /><br />Thanks for your time. <br /><font color="#888888"><br /> -Vaibhav
(*_*)<br/></font></div><br /> 

Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Robert Haas
Дата:
On Fri, Nov 19, 2010 at 10:51 PM, Vaibhav Kaushal
<vaibhavkaushal123@gmail.com> wrote:
> Is no one ready to help on this? :(

Apparently, no one is ready to drop what they are doing to immediately
answer your email before all the other ones they need to answer, but I
wouldn't infer from that that no one wants to help.  It doesn't seem
very realistic to me to expect a 12-hour turnaround on free support,
but what do I know?

With regards to your question, for each type of plan node, there is an
associated "plan state" node.  This is an important distinction
because, IIUC, plans can be reused, so plan state contains the
information that might need to be reset on each run.  Scan state is
just a plan state node for a scan node.  I believe a tuple projection
is what you get when you do something like SELECT
generate_series(1,10) FROM tbl - the set-returning function has to be
"projected" in multiple tuples.  EState I could use some hints on
myself.  A qual is a filter condition, e.g. in SELECT * FROM tbl WHERE
x = 1, the "x = 1" part is a qual.   It's helpful to grep src/include
for the structures in question; the information they contain often
helps to understand their purpose.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:

Thanks a lot for the answer. I see a lot of people discussing so many things so I thought my email would have been ignored by those with a lot coming in already. Thanks for the enlightenment. 

-Vaibhav (*_*)


On Sun, Nov 21, 2010 at 12:25 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Fri, Nov 19, 2010 at 10:51 PM, Vaibhav Kaushal
<vaibhavkaushal123@gmail.com> wrote:
> Is no one ready to help on this? :(

Apparently, no one is ready to drop what they are doing to immediately
answer your email before all the other ones they need to answer, but I
wouldn't infer from that that no one wants to help.  It doesn't seem
very realistic to me to expect a 12-hour turnaround on free support,
but what do I know?

With regards to your question, for each type of plan node, there is an
associated "plan state" node.  This is an important distinction
because, IIUC, plans can be reused, so plan state contains the
information that might need to be reset on each run.  Scan state is
just a plan state node for a scan node.  I believe a tuple projection
is what you get when you do something like SELECT
generate_series(1,10) FROM tbl - the set-returning function has to be
"projected" in multiple tuples.  EState I could use some hints on
myself.  A qual is a filter condition, e.g. in SELECT * FROM tbl WHERE
x = 1, the "x = 1" part is a qual.   It's helpful to grep src/include
for the structures in question; the information they contain often
helps to understand their purpose.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Robert Haas
Дата:
On Sat, Nov 20, 2010 at 1:59 PM, Vaibhav Kaushal
<vaibhavkaushal123@gmail.com> wrote:
> Thanks a lot for the answer. I see a lot of people discussing so many things
> so I thought my email would have been ignored by those with a lot coming in
> already. Thanks for the enlightenment.

Sure.  Just FYI, with these kinds of things, I do try to keep track of
them because I like to try to make sure that everyone gets an answer
back.  But, I don't always have time to do it immediately, and
sometimes I wait even if I do, if I think that someone more
knowledgeable on that particular topic might chime in.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:
I sure do respect that. Appreciated. :)

-Vaibhav (*_*)

On Sun, Nov 21, 2010 at 12:33 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Sat, Nov 20, 2010 at 1:59 PM, Vaibhav Kaushal
<vaibhavkaushal123@gmail.com> wrote:
> Thanks a lot for the answer. I see a lot of people discussing so many things
> so I thought my email would have been ignored by those with a lot coming in
> already. Thanks for the enlightenment.

Sure.  Just FYI, with these kinds of things, I do try to keep track of
them because I like to try to make sure that everyone gets an answer
back.  But, I don't always have time to do it immediately, and
sometimes I wait even if I do, if I think that someone more
knowledgeable on that particular topic might chime in.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Tom Lane
Дата:
Some additional comments ...

Robert Haas <robertmhaas@gmail.com> writes:
> With regards to your question, for each type of plan node, there is an
> associated "plan state" node.  This is an important distinction
> because, IIUC, plans can be reused, so plan state contains the
> information that might need to be reset on each run.

Yeah.  The plan tree is supposed to be read-only so far as the executor
is concerned, so it needs a parallel "plan state" tree to hold its
runtime state.

> I believe a tuple projection
> is what you get when you do something like SELECT
> generate_series(1,10) FROM tbl - the set-returning function has to be
> "projected" in multiple tuples.

I think "projection" is a term out of relational theory, referring to
any sort of tuple-by-tuple manipulation of the data.  For instance,
if you have a row "a, b, c" and you compute "a, c+1" based on that,
that's a projection.  ExecProject() does this in the general case.
The business with SRFs in a targetlist possibly producing multiple
rows is a PostQUEL-ism that doesn't have any standard technical name
that I know of.

> A qual is a filter condition, e.g. in SELECT * FROM tbl WHERE
> x = 1, the "x = 1" part is a qual.

qual = qualifier.  We use that term with various shades of meaning;
notably an indexqual is a qualifier that is useful for searching an
index.  Large parts of the planner also use the term "clause" to mean
about the same thing.

> It's helpful to grep src/include
> for the structures in question;

Here's my single biggest tip for newcomers to the Postgres source:
if you don't use ctags, glimpse, or some other tool that can quickly
show you all references to a given identifier, go out and get one.
It's one of the easiest ways to learn about things.
        regards, tom lane


Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Dimitri Fontaine
Дата:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Here's my single biggest tip for newcomers to the Postgres source:
> if you don't use ctags, glimpse, or some other tool that can quickly
> show you all references to a given identifier, go out and get one.
> It's one of the easiest ways to learn about things.

I've been using cscope (out of advice from Joshua Tolley), and even
better its integration into Emacs which is called xcscope.el --- I
wouldn't have been able to come up with the extension patch series
without that.
 http://cscope.sourceforge.net/

And as a quick teaser, the keys I mostly use:
 C-c s d        cscope-find-global-definition C-c s s        cscope-find-this-symbol C-c s f
cscope-find-this-fileC-c s I        cscope-index-files
 

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:
Thanks for your concerns about my question. I am really happy to get the answers. <br /><br /> @Mr. Tom Lane: Thanks
foryour explanation but I am already using Eclipse which gets me to the definitions real easy. I do not post my
questionson the Hackers forum with any intention to disturb anyone. I just ask for help when I am not able to
understandit all. PG is my first attempt at OSS development so it is particularly difficult. Of course PG has great
supportfor us because almost everything has got its comment, elaborating its use / importance. However since I don't
knoweverything yet about PG or even about the OSS development, I come here asking. I have never been in so much of code
withso many Data Structures and typedefs. It gets confusing very easily. This is the reason I came here asking. <br
/><br/>I ask here after I have done my homework; and after I get messed up with the code. Moreover the comments are
thoseof developers. So when someone says that "expression does not match qual" in the code, it is not so clear to me as
itmight be to you people; because you know the terms, I don't. Thanks for all the support I have been getting here to
allof you. I will try to ask as less as possible from now on. <br /><br />@Mr. Dimitri Fontaine: Thanks for telling me
thename of the tool. But I like the GUI interfaces more and Eclipse has been serving me well for browsing (only) the
sourcecode. I do not fear command line / shell but prefer GUI more. Thanks for your answer. <br /><br />-Vaibhav
(*_*)<br/><br /><div class="gmail_quote">On Sun, Nov 21, 2010 at 2:49 AM, Dimitri Fontaine <span dir="ltr"><<a
href="mailto:dimitri@2ndquadrant.fr">dimitri@2ndquadrant.fr</a>></span>wrote:<br /><blockquote class="gmail_quote"
style="margin:0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Tom
Lane<<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>> writes:<br /> > Here's my single biggest tip
fornewcomers to the Postgres source:<br /> > if you don't use ctags, glimpse, or some other tool that can quickly<br
/>> show you all references to a given identifier, go out and get one.<br /> > It's one of the easiest ways to
learnabout things.<br /><br /></div>I've been using cscope (out of advice from Joshua Tolley), and even<br /> better
itsintegration into Emacs which is called xcscope.el --- I<br /> wouldn't have been able to come up with the extension
patchseries<br /> without that.<br /><br />  <a href="http://cscope.sourceforge.net/"
target="_blank">http://cscope.sourceforge.net/</a><br/><br /> And as a quick teaser, the keys I mostly use:<br /><br />
 C-cs d               cscope-find-global-definition<br />  C-c s s               cscope-find-this-symbol<br />  C-c s f
             cscope-find-this-file<br />  C-c s I               cscope-index-files<br /><br /> Regards,<br /><font
color="#888888">--<br/> Dimitri Fontaine<br /><a href="http://2ndQuadrant.fr" target="_blank">http://2ndQuadrant.fr</a>
   PostgreSQL : Expertise, Formation et Support<br /></font></blockquote></div><br /> 

Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Leonardo Francalanci
Дата:
> Here's my single biggest tip for newcomers to the Postgres  source:
> if you don't use ctags, glimpse, or some other tool that can  quickly
> show you all references to a given identifier, go out and get  one.
> It's one of the easiest ways to learn about  things.


I guess Eclipse is the best tool for the "newcomer" as it gives
you all the references very easily and shows the functions/structs
declaration when you pass with the mouse over one...

http://wiki.postgresql.org/wiki/Working_with_Eclipse





Re: Fwd: What do these terms mean in the SOURCE CODE?

От
Vaibhav Kaushal
Дата:
Thanks for that informative article. :) Taught me a few new points about Eclipse :)<br /><br /><div
class="gmail_quote">OnSun, Nov 21, 2010 at 2:29 PM, Leonardo Francalanci <span dir="ltr"><<a
href="mailto:m_lists@yahoo.it">m_lists@yahoo.it</a>></span>wrote:<br /><blockquote class="gmail_quote"
style="margin:0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">>
Here'smy single biggest tip for newcomers to the Postgres  source:<br /> > if you don't use ctags, glimpse, or some
othertool that can  quickly<br /> > show you all references to a given identifier, go out and get  one.<br /> >
It'sone of the easiest ways to learn about  things.<br /><br /><br /></div>I guess Eclipse is the best tool for the
"newcomer"as it gives<br /> you all the references very easily and shows the functions/structs<br /> declaration when
youpass with the mouse over one...<br /><br /><a href="http://wiki.postgresql.org/wiki/Working_with_Eclipse"
target="_blank">http://wiki.postgresql.org/wiki/Working_with_Eclipse</a><br/><br /><br /><br /></blockquote></div><br
/>

Re: What do these terms mean in the SOURCE CODE?

От
Bruce Momjian
Дата:
Vaibhav Kaushal wrote:
> I am going through the Executor code and come across the following terms
> quite often. Can someone tell me what do they mean (in a few (may be a
> couple of) sentences)?
> 
> 1. Scan State
> 2. Plan State
> 3. Tuple Projection
> 4. EState
> 5. Qual
> 6. Expression
> 
> They sound quite ambiguous in the source code, specially when some of them
> already have terms which have multiple meanings.

Have you read src/backend/executor/README?  It is hard to explain what
these mean without understanding the executor.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +