Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 21466)
+++ wp-includes/wp-db.php	(working copy)
@@ -134,10 +134,10 @@
 	 * Saved info on the table column
 	 *
 	 * @since 1.2.0
-	 * @access private
+	 * @access protected
 	 * @var array
 	 */
-	var $col_info;
+	protected $col_info;
 
 	/**
 	 * Saved queries that were executed
@@ -514,6 +514,20 @@
 	function __destruct() {
 		return true;
 	}
+	
+	/**
+	 * PHP5 style magic getter, used to lazy-load expensive data.
+	 *
+	 * @since 3.5.0
+	 * @param string $var The private member to get, and optionally process
+	 * @return mixed The private member
+	 */
+	function __get( $var ) {
+		if ( 'col_info' == $var )
+			$this->load_col_info();
+		
+		return $this->$var;
+	}
 
 	/**
 	 * Set $this->charset and $this->collate
@@ -1025,6 +1039,7 @@
 		$this->last_result = array();
 		$this->col_info    = null;
 		$this->last_query  = null;
+		@mysql_free_result( $this->result );
 	}
 
 	/**
@@ -1117,19 +1132,12 @@
 			// Return number of rows affected
 			$return_val = $this->rows_affected;
 		} else {
-			$i = 0;
-			while ( $i < @mysql_num_fields( $this->result ) ) {
-				$this->col_info[$i] = @mysql_fetch_field( $this->result );
-				$i++;
-			}
 			$num_rows = 0;
 			while ( $row = @mysql_fetch_object( $this->result ) ) {
 				$this->last_result[$num_rows] = $row;
 				$num_rows++;
 			}
 
-			@mysql_free_result( $this->result );
-
 			// Log number of rows the query returned
 			// and return number of rows selected
 			$this->num_rows = $num_rows;
@@ -1456,6 +1464,20 @@
 		}
 		return null;
 	}
+	
+	/**
+	 * Load the column metadata from the last query.
+	 *
+	 * @since 3.5.0
+	 * 
+	 * @access protected
+	 */
+	protected function load_col_info() {
+		if( empty( $this->col_info ) ) {
+			for ( $i = 0; $i < @mysql_num_fields( $this->result ); $i++ )
+				$this->col_info[$i] = @mysql_fetch_field( $this->result, $i );
+		}
+	}
 
 	/**
 	 * Retrieve column metadata from the last query.
@@ -1467,6 +1489,8 @@
 	 * @return mixed Column Results
 	 */
 	function get_col_info( $info_type = 'name', $col_offset = -1 ) {
+		$this->load_col_info();
+		
 		if ( $this->col_info ) {
 			if ( $col_offset == -1 ) {
 				$i = 0;
