Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 5248)
+++ wp-includes/query.php	(working copy)
@@ -961,7 +961,7 @@
 				}
 			}
 			$q['author_name'] = sanitize_title($q['author_name']);
-			$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
+			$q['author'] = get_user_by_nicename($q['author_name']);
 			$whichauthor .= ' AND (post_author = '.intval($q['author']).')';
 		}
 
Index: wp-includes/registration.php
===================================================================
--- wp-includes/registration.php	(revision 5248)
+++ wp-includes/registration.php	(working copy)
@@ -121,6 +121,7 @@
 
 	wp_cache_delete($user_id, 'users');
 	wp_cache_delete($user_login, 'userlogins');
+	wp_cache_delete($user_nicename, 'usernicenames');
 
 	if ( $update )
 		do_action('profile_update', $user_id);
@@ -181,4 +182,4 @@
 	return wp_create_user($username, $password, $email);
 }
 
-?>
\ No newline at end of file
+?>
Index: wp-includes/user.php
===================================================================
--- wp-includes/user.php	(revision 5248)
+++ wp-includes/user.php	(working copy)
@@ -179,4 +179,25 @@
 	$user_identity	= $user->display_name;
 }
 
+function get_user_by_nicename($nicename) {
+	global $wpdb;
+
+	$user = wp_cache_get($nicename, 'usernicenames');
+
+	if ( $user == -1 )
+		return false;
+
+	if ( $user )
+		return $user;
+
+	$cache = $user = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='$nicename'");
+
+	if ( ! $user )
+		$cache = -1;
+
+	wp_cache_add($nicename, $cache, 'usernicenames');
+
+	return $user;
+}
+
 ?>
