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

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

From
Vaibhav Kaushal
Date:
<p>I think the command 'where' does the same. And the command showed something which looked like was part of
evaluation...itgot me confused. Anyways, thanks robert. I will check that too. I did not know the 'bt' command.<p>--<br
/>Sent from my Android<div class="gmail_quote">On 25 May 2011 23:02, "Robert Haas" <<a
href="mailto:robertmhaas@gmail.com">robertmhaas@gmail.com</a>>wrote:<br type="attribution" /></div> 

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

From
Vaibhav Kaushal
Date:
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@gmail.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@gmail.com> wrote:

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

From
Tom Lane
Date:
Vaibhav Kaushal <vaibhavkaushal123@gmail.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


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

From
Vaibhav Kaushal
Date:
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@sss.pgh.pa.us> wrote:
Vaibhav Kaushal <vaibhavkaushal123@gmail.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