Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Re: how does oracle manage hash maps?

RE: Re: how does oracle manage hash maps?

From: Khedr, Waleed <Waleed.Khedr_at_FMR.COM>
Date: Fri, 13 Feb 2004 09:25:14 -0500
Message-ID: <D91D9D5A73FC694BBC52F1EB26AD410FA2E4AA@MSGBOSCLD2WIN.DMN1.FMR.COM>


Hash chains/buckets used for managing the buffer cache has nothing to do with the hash join. They are completely different topics. For a data blocks to come to buffer cache, a hash function gets applied to block address to determine which buckets it will end up in. For a hash a join to happen, the data needed are read either from buffer cache or directly from files, a hash function is applied to the values of the joined columns themselves, and the join process starts from here. The hash areas/buckets for the hash join is unrelated to hash buckets of the buffer cache.

Regards,

Waleed

-----Original Message-----
From: ryan.gaffuri_at_cox.net [mailto:ryan.gaffuri_at_cox.net] Sent: Friday, February 13, 2004 8:58 AM
To: oracle-l_at_freelists.org
Subject: Re: Re: how does oracle manage hash maps?

I know how the LRU works with linked lists. I've written linked list code before.

>From your diagram I take it that, oracle builds the hash map in the pga. The
number of buckets is a prime number.

Its hard to read your diagram. I'm not quite sure how the hash map links to the buffer chain. In basic hashing methodology each hash bucket points to a specific value.

Jonathan lewis stated that in making the hash map oracle grabs the actually values you want to return. However, those values don't go into the PGA with the hash map do they? I thought all data elements went into the buffer cache?
>
> From: Scott <oraracdba_at_yahoo.com>
> Date: 2004/02/13 Fri AM 12:14:48 EST
> To: oracle-l_at_freelists.org
> CC: ryan.gaffuri_at_cox.net
> Subject: Re: how does oracle manage hash maps?
>
> I hope this diagram shows up. Yahoo is not the best
> for creating diagrams.
>
> This example applies to Oracle7 and Oracle8, although
> in reality there may be multiple LRU chains. In
> Oracle8i the LRU concept is replaced by a touch-count
> algorithm but the idea is the same.
>
> LRU Chain:
> Most Recent Doubly linked list Least Recent
> +------+------+------+ - - - -
> +------+------+------+------+------+
> | | | | | | PTR |
> | | |
> +------+------+------+ - - - -
> +------+------+------+------+------+
> Newly used buffers | We search

for
> are placed at this end. | LRU just FREE buffers
> | points from this
end
> LRUW Chain (Dirty List): | to of the LRU.
> +------+------+ - - +------+ | buffer
Dirty
> buffers
> | | | | | | headers. are
moved
> to
> +------+------+ - - +------+ | LRUW
if there
> (Cleared by DBWR) | is room.
> |
> |
> Hashing is |
> based on DBA |
> modulo the |
> number of buckets. |
> A LATCH protects |
> each hash chain |
> |
> ,-------.
> --------------------------------/----------------------+
> Double
> | Hash |
> <------------------------------/---------------------+
> | linked
> | Bucket| ,--------. ,---------V----.
> ,--------. | | hash
> | 1 | ----->| Buffer |--->| Buffer
> |---->| Buffer |--+ | chain.
> `-------' <-----| Header |<---| Header
> |<----| Header |<---+
> | 40 | | 2 |
> | 999 |
> | | | |
> | |
> |--------| | |
> | |
> |Usr|Wait| | |
> | |
> `--------' `--------------'
> `--------'
> ,-------. | | |
> :
> |SO. |--------------' | |
>
> | | | |
>
> `-------' | |
>
> Buffer Handle | |
>
> state object | |
> | |
> (actual DB blocks)
> | |
> ,-------------------.
> ,-------. | |
> | 1 |
> | Hash | | |
> | |
> | Bucket| | |
> +-------------------+
> | 2 | -->... |
> `---------->| 2 |
> `-------' <--... |
> | |
> |
> +-------------------+
> |
> : :
> |
> +-------------------+
> :
> `-------------------------->| 40 Data Block |
> :
> | |
>
> +-------------------+
>
> : :
>
> +-------------------+
> ,-------.
> | 999 |
> | Hash |
> | |
> | Bucket|
> +-------------------+
> | N |
> | 1000 |
> `-------'
> | |
> There are a PRIME
> +-------------------+
> number of Hash buckets.
>
>
> --- Ryan <ryan.gaffuri_at_cox.net> wrote:
> >
> >
> > When Oracle performs a hash-join it first creates a
> > hashmap. This hash map is placed in the PGA. Now,
> > Oracle uses linked lists to manage the buffer cache.
> > Traditional hashing uses an array for the hash, then
> > a linked list for the collisions. How does Oracle
> > manage this?
> >
> ----------------------------------------------------------------
> > Please see the official ORACLE-L FAQ:
> > http://www.orafaq.com
> >
> ----------------------------------------------------------------
> > To unsubscribe send email to:
> > oracle-l-request_at_freelists.org
> > put 'unsubscribe' in the subject line.
> > --
> > Archives are at
> > http://www.freelists.org/archives/oracle-l/
> > FAQ is at
> > http://www.freelists.org/help/fom-serve/cache/1.html
> >
> -----------------------------------------------------------------
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to: oracle-l-request_at_freelists.org
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
>



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri Feb 13 2004 - 08:25:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US