Re: oracle-l Digest V1 #318

  • From: "Jonathan Lewis" <jonathan@xxxxxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Sat, 6 Nov 2004 12:12:36 -0000

True,

If it's not in the documentation, then there is a fairly
thorough note on Metalink:  1029850.6

Following up on previous posters, I don't think
mod() really counts as a hashing function , so
the business about primes or powers of two is
largely irrelevant.

There is an argument, though, for using prime
numbers in single instance Oracle - but primeness
is actually stronger than the actual requirement,
and the argument is and only relevant if you are using
multiple freelist groups.

The formula for choosing the freelist group is
identical in structure to the formula for choosing
the freelist.

Consider setting:
    freelists = 4
    freelist groups = 2
and check which freelist / freelist group you end up on:

    fl = mod(pid,4) + 1
    flg = mod(pid,2) + 1

pid = 1:    => fl = 2, flg = 2
pid = 2:    => fl = 3, flg = 1
pid = 3:    => fl = 4, flg = 2
pid = 4:    => fl = 1, flg = 1
pid = 5:    => fl = 2, flg = 2
pid = 6:    => fl = 3, flg = 1
pid = 7:    => fl = 4, flg = 2
pid = 8:    => fl = 1, flg = 1
pid = 9:    => fl = 2, flg = 2

Notice how we use only freelists 1 and 3
from freelist group 1, and freelist groups
2 and 4 from freelist group 2.

You avoid this 'collision' type of issue if the
number of freelists and freelist groups are
relatively co-prime.  (And it's a lot easier
to say prime, even though prime is not
actually necessary).

Try running the same test - through 36
consecutive pids with the values
    fl = 9, and flg = 4
and you'll see what I mean

Regards

Jonathan Lewis



: From: "Tanel Poder" <tanel.poder.003@xxxxxxx>
: Subject: Re: freelists
: Date: Sat, 06 Nov 2004 00:25:33 +0200
:
: > The hash function in this case is based on the session id of the
: > connecting user. (mod(SID,FREELISTS)+1).
: >
: > eg SID=10, FREELISTS=3, HASH = mod(10,3)+1 = 1+1 = 2
: I believe the hash function is applied to Oracle PID, not SID. This should 
be in docs as well.
:
: Tanel.
:
:


--
//www.freelists.org/webpage/oracle-l

Other related posts:

  • » Re: oracle-l Digest V1 #318