A somewhat different approach.

Let's generate the ladder off a mysql database on the fly and update on the fly.
I'd have one table with all the user info (name, etc.) and a ladder table with two fields, user_id and ladder.
:ladder_table +------------+-------------+ | Field | Type | +------------+-------------+ | user_id | smallint(6) | | ladder_id | smallint(6) | +------------+-------------+


When you have a situation where user_id 0034 (current ladder ranking of 2345) beats user_id 0638 (current_ladder ranking of 7) you know that the only users who will be affected are those whose ladder ranking is between 7 and 2345.

You can do this in three sql calls.

Your first sql call would clear the winner out of the way.
DELETE from ladder_table where ladder_id = 2345

Then you need to determine how many user_id 0638 is going to fall (through whatever method you come up with). I am going to assume this user is falling ten rankings for this example. This will be necessity shove everyone from ladder_ranking 17 to ladder_ranking 2344 down as well.
UPDATE ladder_table SET ladder_ranking = ladder_ranking -1 WHERE ladder_ranking >= 17 AND ladder_ranking < 2345

The last one is the call setting your user_id 0034 to the ranking of 7.

UPDATE ladder_table SET ladder_ranking = 7 WHERE user_id = 0034


Those calls should be very fast in most cases.
Thanks,

EEjack


In reply to Re: Implementation of a Ladder System by eejack
in thread Implementation of a Ladder System by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.