Doubt in index scan code

From: Suresh <suiyengar(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Doubt in index scan code
Date: 2008-03-08 16:06:18
Message-ID: 597790.92025.qm@web54504.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 ?

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 Bruce Momjian 2008-03-08 17:55:04 Re: Simplifying Text Search
Previous Message Heikki Linnakangas 2008-03-08 09:35:26 Re: CopyReadLineText optimization