ITT #14: Optimizing MySQL Queries

DISCLAIMER: I am by no means a MySQL optimization expert, and I can't guarantee that the information provided in this blog entry will take a query from painfully slow to blazing fast. I can, however, guarantee that this entry was written with the best intentions and aims to explore some of the more advanced features of MySQL.

This week, I wanted to share some of my recent experiments with MySQL queries in regard to lowering the number of requests sent to the database server and, hopefully, avoiding the bottleneck that can form on sites that rely heavily on database interaction.

What Are MySQL Joins?

A JOIN in MySQL is a tool that allows developers to combine one or more tables in a query. There are a few flavors... read more

Beautiful Forms with JavaScript

A while back, I posted a blog called "The JavaScript Switcharoo" that presented a technique for eliminating labels from form inputs. It was pointed out in the comments that this technique not only threw errors in Internet Explorer (not good), but would also cause usability issues for screen readers and other text-only browsers (also not good). I've since rewritten the script to cooperate in the ever-troublesome IE family of browsers, as well as using accessible XHTML markup.

View the Demo | Download the Source Code

What are we going for, here?

The desired outcome of this script is to 1) create a standard comment form, 2) dynamically display form field descriptions inside each form field using the information stored in corresponding label elements, then write functions to 3) hide the description when the user... read more

The JavaScript Switcharoo

NOTE: As noted in the comments, there are some usability issues with this script. An updated version is available here.

I hate form labels.

There. I said it.

I'm opposed to the idea of forcing a little snippet of text to line up next to each form element so that we know what's going on with it. It's difficult, it takes up extra space, and it tends to make something like a newsletter input eat up too much screen real estate.

However, it would be rude of me to just assume that everyone knows what the hell I'm asking for when I slap a couple inputs in the top right of a site.

To get around this issue, I wrote a quick JavaScript function to make... read more

  • «
  • 1
  • »