sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject svn commit: r1370124 - /sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java
Date Tue, 07 Aug 2012 06:12:50 GMT
Author: jarcec
Date: Tue Aug  7 06:12:50 2012
New Revision: 1370124

URL: http://svn.apache.org/viewvc?rev=1370124&view=rev
Log:
SQOOP-539. getPrimaryKeyQuery is very slow in mysql 5.0.77.

(Jhovanny via Jarek Jarcec Cecho)

Modified:
    sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java

Modified: sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java
URL: http://svn.apache.org/viewvc/sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java?rev=1370124&r1=1370123&r2=1370124&view=diff
==============================================================================
--- sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java (original)
+++ sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java Tue Aug  7 06:12:50 2012
@@ -70,6 +70,14 @@ public class MySQLManager
   }
 
   @Override
+  protected String getPrimaryKeyQuery(String tableName) {
+    return "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS "
+         + "WHERE TABLE_SCHEMA = (" + getSchemaQuery() + ") "
+         + "AND TABLE_NAME = '"+tableName+"' "
+         + "AND COLUMN_KEY = 'PRI'";
+  }
+
+  @Override
   protected String getColNamesQuery(String tableName) {
     // Use mysql-specific hints and LIMIT to return fast
     return "SELECT t.* FROM " + escapeTableName(tableName) + " AS t LIMIT 1";



Mime
View raw message