From 86fa0697c84949f28efc9a2ad91a7dfbe78d2dd0 Mon Sep 17 00:00:00 2001
From: S H Mohanjith <moha@mohanjith.net>
Date: Thu, 5 Dec 2013 01:09:23 +0200
Subject: [PATCH] SHOW TABLES is extremely resource intesive query, use SHOW
 TABLES LIKE instead

---
 wp-admin/install-helper.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index c98b28c..e2405bc 100644
--- a/wp-admin/install-helper.php
+++ b/wp-admin/install-helper.php
@@ -53,7 +53,7 @@ if ( ! function_exists('maybe_create_table') ) :
  */
 function maybe_create_table($table_name, $create_ddl) {
 	global $wpdb;
-	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+	foreach ($wpdb->get_col("SHOW TABLES LIKE '{$table_name}'",0) as $table ) {
 		if ($table == $table_name) {
 			return true;
 		}
@@ -61,7 +61,7 @@ function maybe_create_table($table_name, $create_ddl) {
 	//didn't find it try to create it.
 	$wpdb->query($create_ddl);
 	// we cannot directly tell that whether this succeeded!
-	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+	foreach ($wpdb->get_col("SHOW TABLES LIKE '{$table_name}'",0) as $table ) {
 		if ($table == $table_name) {
 			return true;
 		}
-- 
1.7.11.1

