Jump to content
  • use timestamp instead of a string to store a date in the DB


    MrFreak
    • Status: Unconfirmed
      Main Category: Core / Mangos Daemon
      Sub-Category: Code Enhancement
      Version: 0.20 Milestone: 20 Priority: unprioritised
      Implemented Version: 0.20

    use timestamp instead of a string to store a date in the DB

    For example, look at the uptime table in the realmd db: [url]http://getmangos.eu/wiki/Reference%20Information/DB/realm/uptime.md[/url]

    [QUOTE]
    Field 'starttime'
    The time when the server was started, in Unix time.

    Field 'startstring'
    The time when the server started, formated as a readable string.
    [/QUOTE]

    Both fields contain the same: a date. But they are stored differently. Every date in the database should be either stored as a string or as a timestamp. It shouldn't be mixed so both exists. I think it is better to use everywhere in the database for a date a timestamp for performance reasons.


    User Feedback

    Recommended Comments

    The Unix timestamp uses less data. Let's assume a string with no hyphens like "20140918203045" which means "2014-Sep-19 at 20:30 and 45sec". This uses 14bytes of data. A timestamp is a 32bit integer, which uses 4bytes. It could save loads of space depending on how string dates are stored.

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use