In the #maria IRC channel the other day I fielded a question someone had about a DATETIME column where they wanted to SELECT by the year. The answer (which is probably obvious to many of you) is to use the YEAR() function like so:

(The above assumes the table is named “t1” and the DATETIME column is named “d“.)

In my reply I provided a link to the Date and Time Functions section of the AskMonty Knowledgebase, but when I looked at the entry for the YEAR() function, I noticed that the example given (which originated from the file scripts/fill_help_tables.sql which is found in the MySQL and MariaDB source) was not very helpful:

The above is certainly a valid use of the YEAR() function, but it’s not a real-world use (at least, I don’t know why anyone would use the above SELECT statement in a real application). So I added an example which I feel is more useful, especially to someone unfamiliar with using SQL functions:

Looking at the entries for other functions in both the Date and Time functions section and elsewhere there is a pattern of examples that are useful, but — like the original YEAR() example — useless in the real world.

I have now added better examples to several of the date and time functions but they can probably be improved even more and there are many more entries in the Knowledgebase that would also benefit from better examples. The good news is adding examples to Knowledgebase entries is very easy to do. The bad news is that if I think of all of the examples on my own they will be similar and probably boring, so I’d like to ask for some help.

If you’ve ever wanted to contribute to MariaDB, but didn’t know where to begin, I have a suggestion: Look under the Functions and Operators section of the AskMonty Knowledgebase, find a function or two in need of better examples, and add some (either directly or via a comment). Don’t worry if you are unfamiliar with editing the Knowledgebase. I can clean things up and make your examples look pretty after the fact. Just make sure your awesome new examples actually work. :)

Thanks!

We all know that Kurt von Finck is going to give a talk at Percona Live NYC happening May 26 2011. If you want to attend we’ve got three tickets to give away (worth USD$249 each).

This should be the easiest contest ever to enter and win. Just go to the Knowledgebase, create an account and write one new article, longer than 2 paragraphs. Once you’re done, send a quick email to community@montyprogram.com with a link to the article, and if there is no duplicate content already on the Knowledgebase, you’ll get your ticket to Percona Live NYC.

Good luck!

Contest ends May 24 2011, noon, UTC+0.

Yesterday I set up a new machine for our MariaDB Buildbot. This is quite an important build host for us, it runs more than 20 different builds for each push into our most important trees, and is the host that builds most of our release packages. So quite a workhorse! It is a pretty fast machine, with 5 SSD disks, 48GB of RAM and 2 x quad-core Intel Xeon E5420.

This is a replacement for the previous machine serving the same builds. The previous machine was also nice, at least on paper, with no less than 24 cores. Unfortunately we were never able to run that machine stably, it would crash/hang every few days requiring manual power cycling, which was unacceptable, of course.

The new host has been running for a day or so and seems to work well, hopefully it will prove to be more stable. I wanted to do a quick comparison of the speed of builds on the new host compared to the old:

Overall, the new builder looks about the same speed as the old one, maybe a bit faster even. Which is quite nice, given that the old one has three times the number of cores. The windows build is though significantly faster. This is probably because it turns out this is quite I/O heavy for some reason, and the new host, having SSD for storage, has significantly better I/O performance.