Badge 2

News Category

WordPress 3.0 “Thelonious”. Say goodnight, Drupal.

Friday, June 25th, 2010

I recently got a chance to do some professional development with the latest WordPress 3.0 “Thelonious” release and it blew me out of the water. For a while now, I’ve been doing some work on the side in web design/development (I love to code, but I’m a designer at heart) and I use WordPress almost exclusively. I have to say, I’m very excited about the new features, menus in general, and their apparent redirection towards content management and less of a sole focus on blogging.

The menus are absolutely awesome. I’ve written and used extensions in the past to accomplish the same goal, but nothing beats out-of-the-box support with a Apple-esk UI only WordPress can provide. Multi-level support, drag/drop from content areas and built-in javascript for drop-downs all equal a vast improvement to an already great system. Best yet, the API function and the modifications to the theme to enable menus took me about 5 minutes to figure out.

For me, working with Drupal for an extended amount of time was painful. If a client wanted a complete CMS, it was hard to argue that a blog was their best solution. Often times, I’d green light Drupal just to avoid my least favorite word: Joomla (aims gun at head). Don’t get me wrong, these are fine products; it’s just that sometimes if you need to write in space, a pencil works better than a quill connected with a straw to an ink tank connected to a vacuum connected to a car battery. Is it really necessary to have a settings page with more options than there are hairs on my body?

Oh, and as someone who’s written extensions for all three of the PHP-base CMS players, you can not beat WordPress. I had my CATS JobSite page up and running in an hour — svn and release management included. Did I mention that Joomla has like 5 names for ‘plugin’? As if figuring out whether to call something a plugin, extension, addon, toolbar, module, etc. wasn’t hard enough, Joomla just grabbed the top 5… and I’m done with the complaining.

Back to point: if you need a blog, use WordPress. If you need a website your mom could add content to, use WordPress. Need more proof? I dare you to find a sexier video from an open source project.

  • Facebook
  • Twitter

Posted in HTML, News | 1 Comment »

Fixed MySQL slow queries using indexes by removing string to date conversion warnings

Sunday, May 23rd, 2010

This is just a quick one for an issue I ran into today when I was tuning some MySQL indexes for better performance. Some of our older PHP code was performing a SELECT using a BETWEEN to specify a date range. After adding an index to speed up this range query, I noticed that it wasn’t taking and was still performing a table scan/file sort.

The code was using PHP’s date function with the ‘c’ format string, which inserts a date/time string like so: “2010-05-23T16:45:08-05:00″. When inserting or comparing dates, MySQL will automatically convert this to it’s internal date/time format; but, it will throw a warning.

It turns out that the warning was causing MySQL to ignore the new index for the range query even through it was listed as the used index in the EXPLAIN. My guess is that this has something to do with MySQL having to convert each string to a date on a per-row basis, causing its optimizer to use the index inefficiently.

Simply changing the PHP date function’s format string from ‘c’ to ‘Y-m-d H:i:a’ (which is a native MySQL date/time format) did the trick. The explain remained the same, but the number of rows was drastically reduced from hundreds of thousands to a few hundred (the result of the range) which took a 20 second query down to about a tenth of a second.

I haven’t tested it, but my guess is this will occur with any type of conversion that results in a warning, such as a string with text in it being converted to a number, truncated values, etc.. MySQL probably doesn’t cache those conversions up front, which leads to expensive conversions on a per-row basis which ultimately tanks any benefit an index will give you — despite what the EXPLAIN tells you!

Something to keep in mind — watch those warnings!

  • Facebook
  • Twitter

Posted in Linux, News, Uncategorized | Comments Off