MySQL Forums
Forum List  »  Performance

What is faster: from_unixtime() or unix_timestamp()?
Posted by: Dmitry Katsubo
Date: October 07, 2005 03:17PM

Can some please give a hint:

For examle, I have some file timestamp. And now I want to compare it with some datetme column in the table (in the examle below I will compare with now()). So I wonder, what is faster:

1) Pass a timestamp as number:
select case when from_unixtime(1128719129) > now() then 1 else 0 end;

2) Perform a query:
select unix_timestamp();
and then compare with timestamp in the high-level application

3) Pass a timestamp as a string:
select case when '2005-10-08 00:10:10' > now() then 1 else 0 end;

I guess, the first one should be faster, as aviods multiple strings parsing?

Thanks.

Options: ReplyQuote


Subject
Views
Written By
Posted
What is faster: from_unixtime() or unix_timestamp()?
3324
October 07, 2005 03:17PM


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.