Re: Expression Evaluator used for creating the plan tree / stmt ?

Lists: pgsql-hackers
From: Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expression Evaluator used for creating the plan tree / stmt ?
Date: 2011-05-25 18:15:12
Message-ID: BANLkTi=DRR_nh-uOh6ifiM21YohVT0naiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I think the command 'where' does the same. And the command showed something
which looked like was part of evaluation...it got me confused. Anyways,
thanks robert. I will check that too. I did not know the 'bt' command.

--
Sent from my Android
On 25 May 2011 23:02, "Robert Haas" <robertmhaas(at)gmail(dot)com> wrote:


From: Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expression Evaluator used for creating the plan tree / stmt ?
Date: 2011-05-27 03:33:47
Message-ID: BANLkTinBetAjvtK5r8rj6UdW8ZWcm+9btQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

OK, I ran a GDB trace into ExecScan and here is a part of it:

#########################

(gdb) finish
Run till exit from #0 ExecScanFetch (node=0x1d5c3c0,
accessMtd=0x55dd10 <SeqNext>, recheckMtd=0x55db70 <SeqRecheck>)
at execScan.c:44
194 if (TupIsNull(slot))
(gdb) s
205 econtext->ecxt_scantuple = slot;
(gdb) s
206 int num_atts = slot->tts_tupleDescriptor->natts;
(gdb) s
207 elog(INFO, "========[start] BEFORE ExecQual===========");
(gdb) s
206 int num_atts = slot->tts_tupleDescriptor->natts;
(gdb) s
207 elog(INFO, "========[start] BEFORE ExecQual===========");
(gdb) s
elog_start (filename=0x7c9db2 "execScan.c", lineno=207,
funcname=0x7c9e69 "ExecScan") at elog.c:1089
1089 {
(gdb)

##########################

Why do these lines:

########################

206 int num_atts = slot->tts_tupleDescriptor->natts;
(gdb) s
207 elog(INFO, "========[start] BEFORE ExecQual===========");

########################

repeat twice? I have written them only once! GDB documentation does not
help! A few forums I am on, people accuse me of anything between bad
programming to recursion. Any idea? I never face this with rest of the code
(and in no other program). I am on Fedora 13 X86_64.

Regards,
Vaibhav

On Wed, May 25, 2011 at 11:45 PM, Vaibhav Kaushal <
vaibhavkaushal123(at)gmail(dot)com> wrote:

> I think the command 'where' does the same. And the command showed something
> which looked like was part of evaluation...it got me confused. Anyways,
> thanks robert. I will check that too. I did not know the 'bt' command.
>
> --
> Sent from my Android
> On 25 May 2011 23:02, "Robert Haas" <robertmhaas(at)gmail(dot)com> wrote:
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expression Evaluator used for creating the plan tree / stmt ?
Date: 2011-05-27 03:48:21
Message-ID: 2775.1306468101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com> writes:
> Why do these lines:
> ...
> repeat twice?

Hm, you're new to using gdb, no? That's pretty normal: gdb is just
reflecting back the fact that the compiler rearranges individual
instructions as it sees fit. You could eliminate most, though perhaps
not all, of that noise if you built the program-under-test (ie postgres)
at -O0.

regards, tom lane


From: Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expression Evaluator used for creating the plan tree / stmt ?
Date: 2011-05-27 03:59:17
Message-ID: BANLkTimXMzcjZNWHP6+CTuv9esow6WAL8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thanks Tom. Comparing to you people, I am definitely new to almost
everything here. I did debug a few smaller programs and never seen anything
as such. So asked. Moreover, those programs I compiled never used any
optimization.

While everything seems to be working, it looks like the slot values do not
change and all rows in a sequential scan return the first value it finds on
the disk, n number of times, where n = number of rows in the table! I am
going to compile without optimization now. Hopefully that would change a few
things in the debugging process.

Seems beautiful, complicated, mysterious. And I thought I was beginning to
understand computers. :)

Whatever be the case, I will look more into it and ask again if I get into
too much of trouble.

Regards,
Vaibhav

On Fri, May 27, 2011 at 9:18 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com> writes:
> > Why do these lines:
> > ...
> > repeat twice?
>
> Hm, you're new to using gdb, no? That's pretty normal: gdb is just
> reflecting back the fact that the compiler rearranges individual
> instructions as it sees fit. You could eliminate most, though perhaps
> not all, of that noise if you built the program-under-test (ie postgres)
> at -O0.
>
> regards, tom lane
>