Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11075)
+++ wp-includes/post.php	(working copy)
@@ -1276,7 +1276,7 @@
 		$limit = "LIMIT $num";
 	}
 
-	$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
+	$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date_gmt DESC $limit";
 	$result = $wpdb->get_results($sql,ARRAY_A);
 
 	return $result ? $result : array();
Index: wp-includes/version.php
===================================================================
--- wp-includes/version.php	(revision 11075)
+++ wp-includes/version.php	(working copy)
@@ -15,6 +15,6 @@
  *
  * @global int $wp_db_version
  */
-$wp_db_version = 10850;
+$wp_db_version = 10880;
 
 ?>
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 11075)
+++ wp-includes/query.php	(working copy)
@@ -2022,7 +2022,7 @@
 
 		// Order by
 		if ( empty($q['orderby']) ) {
-			$q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
+			$q['orderby'] = "$wpdb->posts.post_date_gmt ".$q['order'];
 		} else {
 			// Used to filter values
 			$allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 11075)
+++ wp-includes/wp-db.php	(working copy)
@@ -714,6 +714,12 @@
 
 			// Return number of rows selected
 			$return_val = $this->num_rows;
+			
+			// log explain
+			if ( defined('QUERIES_DEBUG') && defined('SAVEQUERIES') && QUERIES_DEBUG && SAVEQUERIES && 'SELECT FOUND_ROWS()' != $query ) {
+				$explain = @mysql_query("EXPLAIN $query", $this->dbh);
+				$this->queries[] = @mysql_fetch_object($explain);
+			}
 		}
 
 		return $return_val;
Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 11075)
+++ wp-includes/general-template.php	(working copy)
@@ -776,7 +776,7 @@
 	$output = '';
 
 	if ( 'monthly' == $type ) {
-		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
+		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY YEAR(post_date) DESC, MONTH(post_date) DESC $limit";
 		$key = md5($query);
 		$cache = wp_cache_get( 'wp_get_archives' , 'general');
 		if ( !isset( $cache[ $key ] ) ) {
Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 11075)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -1182,7 +1182,7 @@
 	if ( count($search_terms) > 1 && $search_terms[0] != $s )
 		$search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
 
-	$posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date_gmt DESC LIMIT 50" );
+	$posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date DESC LIMIT 50" );
 
 	if ( ! $posts )
 		exit( __('No posts found.') );
Index: wp-admin/includes/upgrade.php
===================================================================
--- wp-admin/includes/upgrade.php	(revision 11075)
+++ wp-admin/includes/upgrade.php	(working copy)
@@ -654,22 +654,23 @@
 
 	if ( $wp_current_db_version < 3506 ) {
 		// Update status and type.
-		$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
-
-		if ( ! empty($posts) ) foreach ($posts as $post) {
-			$status = $post->post_status;
-			$type = 'post';
-
-			if ( 'static' == $status ) {
-				$status = 'publish';
-				$type = 'page';
-			} else if ( 'attachment' == $status ) {
-				$status = 'inherit';
-				$type = 'attachment';
-			}
-
-			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
-		}
+		$wpdb->query("
+			UPDATE	$wpdb->posts
+			SET		post_type = CASE
+					WHEN post_status = 'page'
+					THEN 'page'
+					WHEN post_status = 'attachment'
+					THEN 'attachment'
+					ELSE 'post'
+					END,
+					post_status = CASE
+					WHEN post_status = 'page'
+					THEN 'publish'
+					WHEN post_status = 'attachment'
+					THEN 'inherit'
+					ELSE post_status
+					END;
+			");
 	}
 
 	if ( $wp_current_db_version < 3845 ) {
Index: wp-admin/includes/schema.php
===================================================================
--- wp-admin/includes/schema.php	(revision 11075)
+++ wp-admin/includes/schema.php	(working copy)
@@ -136,9 +136,12 @@
   post_mime_type varchar(100) NOT NULL default '',
   comment_count bigint(20) NOT NULL default '0',
   PRIMARY KEY  (ID),
+  KEY post_author (post_author),
   KEY post_name (post_name),
-  KEY type_status_date (post_type,post_status,post_date,ID),
-  KEY post_parent (post_parent)
+  KEY type_date (post_type, post_date),
+  KEY type_parent (post_type, post_parent),
+  KEY type_date_gmt (post_type, post_date_gmt),
+  KEY type_modified_gmt (post_type, post_modified_gmt)
 ) $charset_collate;
 CREATE TABLE $wpdb->users (
   ID bigint(20) unsigned NOT NULL auto_increment,
Index: wp-admin/includes/user.php
===================================================================
--- wp-admin/includes/user.php	(revision 11075)
+++ wp-admin/includes/user.php	(working copy)
@@ -324,7 +324,7 @@
 		$other_unpubs = '';
 	} else {
 		$editable = join(',', $editable);
-		$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
+		$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified_gmt $dir", $user_id) );
 	}
 
 	return apply_filters('get_others_drafts', $other_unpubs);
@@ -389,7 +389,7 @@
  */
 function get_users_drafts( $user_id ) {
 	global $wpdb;
-	$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
+	$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified_gmt DESC", $user_id);
 	$query = apply_filters('get_users_drafts', $query);
 	return $wpdb->get_results( $query );
 }
