Showing entries 1 to 4
Displaying posts with tag: Microseconds (reset)
time for standards 2

I was a bit wrong in my previous post. MySQL 5.6 does allow you to supply a fsp with CURRENT_TIMESTAMP (thanks Roy).

mysql> SELECT CURRENT_TIMESTAMP,CURRENT_TIMESTAMP(6);
+---------------------+----------------------------+
| CURRENT_TIMESTAMP | CURRENT_TIMESTAMP(6) |
+---------------------+----------------------------+
| 2013-10-27 10:38:59 | 2013-10-27 10:38:59.182530 |
+---------------------+----------------------------+
1 row in set (0.00 sec)


It however feels a bit weird to me as the CURRENT_TIMESTAMP is often used without () and doesn't look like a function. So when I tried to use a CURRENT_TIMESTAMP with a fsp of 6 it was not behaving how I expected it to be:

mysql> CREATE TABLE t1 (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6));
ERROR 1067 (42000): Invalid …
[Read more]
time for standards

MySQL 5.6 includes support for microsecode timestamp resolution, which is a great new feature.

To get the current timestamp in MySQL 5.5 you could use NOW(), SYSDATE() or CURRENT_TIMESTAMP.

mysql_5.5> SELECT NOW(),SYSDATE(),CURRENT_TIMESTAMP;
+---------------------+---------------------+---------------------+
| NOW() | SYSDATE() | CURRENT_TIMESTAMP |
+---------------------+---------------------+---------------------+
| 2013-10-26 15:46:24 | 2013-10-26 15:46:24 | 2013-10-26 15:46:24 |
+---------------------+---------------------+---------------------+
1 row in set (0.01 sec)


If we run the same statement in MySQL 5.6 the output is the same. This is great for compatibility, but what if we want those microsecond timestamps?

[Read more]
Added a Table of Contents

Not a big deal, but I just added a “Table of Contents” page to my blog to make finding older articles much easier.

I noticed most of my posts are quite lengthy, and it can take a bit of searching/clicking to find an older entry. So unless you happen to recall the ‘month/year’ it was published, which I don’t even remember that, then hopefully this will help.

Really simple, and looks just like this:

[Read more]
Microseconds and MariaDB

Most of you are all aware of the lack of microsecond support in MySQL.

This has been a long-standing issue:

http://bugs.mysql.com/bug.php?id=8523

*cringe* .. sorry, just my normal reaction after seeing that bug, err feature request, again and again over the past 6+ years ..

However, I think many people do not realize that microseconds are supported by MariaDB in version 5.3+, which for all intensive purposes is a drop-in replacement for MySQL.

So if you need microsecond support for MySQL, you should definitely check out MariaDB.

“In MariaDB 5.3, the TIME, DATETIME, and TIMESTAMP types, along with the temporal functions, CAST and dynamic columns, now support microseconds. The datetime precision of a column can be specified when creating the table with CREATE TABLE”

Also:

“Generally, the precision can be …

[Read more]
Showing entries 1 to 4