What's more efficient when working with mySQL? Save a date in unix timestamp within an integer field or using unix_timestamp() function on a string field with a date formated like 'Sat May 12 22:52:01 +0000 2012'? I will be using this field to count and group rows.
-
-
Answer:
The integer, which is 4-bytes, blows the string away, which I counted to be 30 characters which usually ends up being approximately that many bytes. Also note that there is a TIMESTAMP column type in MySQL that is used for this very purpose: it stores unixtimes in 4 bytes and lets you use all sorts of nice date manipulation functions instead of manipulating the integers yourself. TIMESTAMP is the most efficient way to store a timestamp, that is until 4 byte unixtimes wrap around in 2038, at which time it will be Y2K all over again.
Jay Janssen at Quora Visit the source
Related Q & A:
- How can I convert a string number to a number in Perl?Best solution by Stack Overflow
- What's causing warnings when clicking a link in a newsletter/email message?Best solution by Webmasters
- What's it called when you get bloated abnormally quickly?Best solution by answers.yahoo.com
- What's a really cute song to sing to a guy you like?Best solution by Yahoo! Answers
- What's more important when renting: Credit history or Rental history?Best solution by e-renter.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.