Re: Doubt in index scan code

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Suresh <suiyengar(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Doubt in index scan code
Date: 2008-03-08 22:12:25
Message-ID: E7832549-40CE-48BD-B3B0-4BC463F9F97F@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 8-Mar-08, at 11:06 AM, Suresh wrote:

> Hello all,
>
> I have a custom code written inside postgres in an application we use.
> The snippet is as below :
> Here inner plan is an index scan.
>
> scandesc = ((IndexScanState *)innerPlan)->iss_ScanDesc;
>
> flag=index_getmulti(scandesc, &tidelm->tid, 1, &ret_tids);
>
> Now consider a query like
>
> explain select * from dept,manager where did=id ;
> QUERY PLAN
> ---------------------------------------------------------------------------
> Nested Loop (cost=0.00..269.09 rows=45 width=72)
> -> seq scan on manager (cost=0.00..6.50 rows=45 width=36)
> -> Index Scan using id1 on dept (cost=0.00..5.82 rows=1 width=36)
> Index Cond: ("outer".did = dept.id)
>
> Say seq scan retrieves did in the order 30,10, 20.. My doubt is in
> what order
> will index_getmulti return tids. How does the scandesc work ?
>
> Will it return the tids as firstly macthing inners for dept=30, then
> dept=10 ?
>
since you have no order by clause in the query rows will be returned
in the order they are found on the disc.

Dave
> Please help me with this.
>
> Thanks and regards,
> Suresh
>
>
>
>
>
>
>
>
>
>
>
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
> Try it now.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-09 00:33:54 Re: patternsel() and histogram_selectivity() and the hard cutoff of 100
Previous Message Jan Urbański 2008-03-08 22:06:55 Re: Google Summer of Code 2008