MySQL Forums
Forum List  »  Performance

Re: What is faster: from_unixtime() or unix_timestamp()?
Posted by: KimSeong Loh
Date: October 09, 2005 09:53AM

A guess, mysql is converting into mysql datetime format, and it seems more efficient to convert from a date time string than converting from a unix timestamp value.

From mysql internals document
DATETIME
Storage: eight bytes.
Part 1 is a 32-bit integer containing year*10000 + month*100 + day.
Part 2 is a 32-bit integer containing hour*10000 + minute*100 + second.

Another test
select benchmark(1000000, 1128719129 > unix_timestamp(now()));

Looks like unix_timestamp() is faster than from_unixtime().

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: What is faster: from_unixtime() or unix_timestamp()?
1866
October 09, 2005 09:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.