Jump to content

Store Date as INT or as DATETIME in Mysql?


cunoodle2

Recommended Posts

I'm just curious as to which would use less resources/cpu processing?  In the past I've always just used the unix epoch integer and then used date() in php to format the output.

 

I'm working on a high volume website and looking to trim all resources as slim as possible for fast processing and am just curious.

 

In either case I need to do some form of processing to either convert the epoch using to date() to the proper output or convert the way that MySQL stores the data ("‘YYYY-MM-DD HH:MM:SS’ ") to the proper output to the screen.

 

Any input/discussion would be much appreciated.

Storing the data is a timestamp will allow you to process it using mysql's date / tile functions. You can also do all your formatting in your queries.

Not sure why you chose TIMESTAMP instead of DATETIME... TIMESTAMP has all sorts of buggy unexpected "features".

 

Which is faster and using less resources?  Converting from the epoch INT to date() or converting the output in the mysql query?

 

Mods:  Does anyone know what phpfreaks does for timestamp processing???

Huh? Why are you converting?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.