one more the following example we dont need sort right.But in this case also relations were scanned sequentially one by one.So is it the case that any relation is accessed only once from database while executing a given query?

praveen=# explain select count(*) from a_9000_0,b_9000_0;
                                    QUERY PLAN
 Aggregate  (cost=537566595.00..537566595.01 rows=1 width=0)
   ->  Nested Loop  (cost=7616.00..485726595.00 rows=20736000000 width=0)
-> Seq Scan on a_9000_0 (cost=0.00..6979.00 rows=144000 width=0)
         ->  Materialize  (cost=7616.00..9549.00 rows=144000 width=0)
-> Seq Scan on b_9000_0 (cost=0.00..6979.00 rows=144000 width=0)
(5 rows)


On Fri, 8 Sep 2006, Heikki Linnakangas wrote:

Date: Fri, 08 Sep 2006 15:30:37 +0100
From: Heikki Linnakangas <[EMAIL PROTECTED]>
To: Praveen Kumar N <[EMAIL PROTECTED]>
Subject: Re: [HACKERS] postgresql shared buffers

Praveen Kumar N wrote:
On Fri, 8 Sep 2006, Heikki Linnakangas wrote:

Looks like Alvaro guessed right. It reads both relations in sequence, sorts them in temporary storage, outside bufmgr, and then does a merge join on the sorted inputs.

could you tell me how can we trace that? I mean which functions shall I checkout for that.

The sort code is in src/backend/utils/sort/tuplesort.c and logtape.c. Can't remember function names from the top of my head.

 N Praveen Kumar
 Btech-IV CSE

        Imagination is more important than knowledge...
                                --Albert Einstein

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to