Re: HashJoin order, hash the large or small table? Postgres likes to hash the big one, why?

From: Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>
To: Scott Carey <scott(at)richrelevance(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performance(at)postgresql(dot)org Performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: HashJoin order, hash the large or small table? Postgres likes to hash the big one, why?
Date: 2010-10-19 14:22:42
Message-ID: 4CBDA9B2.2040807@vmsinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Scott Carey wrote:
>
> If the cost to hash is 1200493, and it needs to probe the hash 20241 times, why would the total cost be 631471410? The cost to probe can't be that big! A cost of 500 to probe and join?
> Why favor hashing the large table and probing with the small values rather than the other way around?
>
>

May I ask a stupid question: how is the query cost calculated? What are
the units? I/O requests? CPU cycles? Monopoly money?

--

Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
http://www.vmsinfo.com
The Leader in Integrated Media Intelligence Solutions

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-10-19 14:25:34 Re: Help with duration of statement: EXECUTE <unnamed> [PREPARE: COMMIT]
Previous Message Greg Spiegelberg 2010-10-19 14:12:48 Re: how to get the total number of records in report