Re: Selection of join algorithm - Mailing list pgsql-novice

From Amol Bhangdiya
Subject Re: Selection of join algorithm
Date
Msg-id CADaB4eBfBTySqGvh_4wvoDv62Eor3pZ28kZv7q8iYw7GSknW0w@mail.gmail.com
Whole thread Raw
In response to Selection of join algorithm  (Ishaya Bhatt <ishayabhatt@gmail.com>)
List pgsql-novice
If you specify joining condition other than equality then nested loop join is invoked.
Example Query : explain analyze select name from student,takes where student.id > takes.id

If both the input to join is sorted on joining condition then merge join is invoked.
Example Query: explain analyze select stud.name from (select id, name from student order by id) stud,(select id,year from takes order by id) t where stud.id = t.id




On Sat, Mar 8, 2014 at 7:50 PM, Ishaya Bhatt <ishayabhatt@gmail.com> wrote:
Hi,

I am trying to analyze join performance. But I see that even for a table having 100,000 rows and join attribute as primary key, postgres always performs hash join.

Can anyone please tell me under which conditions merge join or nested loop join is invoked?

Thanks and Regards,
Ishaya

pgsql-novice by date:

Previous
From: Ishaya Bhatt
Date:
Subject: Selection of join algorithm
Next
From: Michael Rowan
Date:
Subject: Trigger function