Results 1 to 2 of 2
  1. #1

    Simple question about HEAP type mysql tables

    I read that they are faster since they store data in the memory but the negative is that data is lost when mysql is restarted which makes the HEAP table ideal for temporary sessions. My question is what does it use up a lot of server RAM to a point where it would slow things down as well? Thanks

  2. #2
    Join Date
    Nov 2005
    Palma de Mallorca, Spain
    Well, it depends, of course This is my personal experience/example.

    I have a HEAP live example that doesn't eat much memory at all...

    I use a HEAP table to store session data for an user-account system that needs to keep track if an "user-is-already-logged". So, you cannot access an account if there is anybody else already using it.

    This check could not sound very intensive, but think about updating the 'timestamp' for the session every page hit and when you also have to control content-access based on account privileges (in this case is subscription status, or anything else).

    So I benefit here from a HEAP table for faster / cheaper I/O lookups, and is *not* a table that will grow up dangerously, since it just contains users that are logged in.

    If MySQL or server restarts or crash, I don't care this data being destroyed, as I've already failed to keep these users "logged" in, and the results are they need to re-login once the system gets up again.

    Anyway, a 'purge' script is needed in order to clean 'timed-out' user sessions that did not logged out nicely, etc.


    Last edited by juangake; 12-15-2006 at 10:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts