Author: kahatlen
Date: Fri Feb 25 09:17:27 2011
New Revision: 1074449
URL: http://svn.apache.org/viewvc?rev=1074449&view=rev
Log:
DERBY-5067: Performance regression tests should populate tables before creating indexes
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/BankAccountFiller.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/SingleRecordFiller.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/BankAccountFiller.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/BankAccountFiller.java?rev=1074449&r1=1074448&r2=1074449&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/BankAccountFiller.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/BankAccountFiller.java
Fri Feb 25 09:17:27 2011
@@ -147,7 +147,7 @@ public class BankAccountFiller implement
Statement s = c.createStatement();
s.executeUpdate("CREATE TABLE " + ACCOUNT_TABLE +
- "(ACCOUNT_ID INT PRIMARY KEY, " +
+ "(ACCOUNT_ID INT NOT NULL, " +
"BRANCH_ID INT NOT NULL, " +
// The balance column must be able to hold 10
// digits and sign per TPC-B spec, so BIGINT
@@ -156,7 +156,7 @@ public class BankAccountFiller implement
"EXTRA_DATA CHAR(" + ACCOUNT_EXTRA + ") NOT NULL)");
s.executeUpdate("CREATE TABLE " + BRANCH_TABLE +
- "(BRANCH_ID INT PRIMARY KEY, " +
+ "(BRANCH_ID INT NOT NULL, " +
// The balance column must be able to hold 10
// digits and sign per TPC-B spec, so BIGINT
// is needed.
@@ -164,7 +164,7 @@ public class BankAccountFiller implement
"EXTRA_DATA CHAR(" + BRANCH_EXTRA + ") NOT NULL)");
s.executeUpdate("CREATE TABLE " + TELLER_TABLE +
- "(TELLER_ID INT PRIMARY KEY, " +
+ "(TELLER_ID INT NOT NULL, " +
"BRANCH_ID INT NOT NULL, " +
// The balance column must be able to hold 10
// digits and sign per TPC-B spec, so BIGINT
@@ -192,6 +192,8 @@ public class BankAccountFiller implement
*/
private void fillTables(Connection c) throws SQLException {
+ Statement s = c.createStatement();
+
PreparedStatement atIns =
c.prepareStatement("INSERT INTO " + ACCOUNT_TABLE +
"(ACCOUNT_ID, BRANCH_ID, ACCOUNT_BALANCE, " +
@@ -203,6 +205,10 @@ public class BankAccountFiller implement
atIns.executeUpdate();
}
atIns.close();
+
+ s.executeUpdate("ALTER TABLE " + ACCOUNT_TABLE + " ADD CONSTRAINT " +
+ ACCOUNT_TABLE + "_PK PRIMARY KEY (ACCOUNT_ID)");
+
c.commit();
PreparedStatement btIns =
@@ -215,6 +221,10 @@ public class BankAccountFiller implement
btIns.executeUpdate();
}
btIns.close();
+
+ s.executeUpdate("ALTER TABLE " + BRANCH_TABLE + " ADD CONSTRAINT " +
+ BRANCH_TABLE + "_PK PRIMARY KEY (BRANCH_ID)");
+
c.commit();
PreparedStatement ttIns =
@@ -228,7 +238,13 @@ public class BankAccountFiller implement
ttIns.executeUpdate();
}
ttIns.close();
+
+ s.executeUpdate("ALTER TABLE " + TELLER_TABLE + " ADD CONSTRAINT " +
+ TELLER_TABLE + "_PK PRIMARY KEY (TELLER_ID)");
+
c.commit();
+
+ s.close();
}
/**
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/SingleRecordFiller.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/SingleRecordFiller.java?rev=1074449&r1=1074448&r2=1074449&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/SingleRecordFiller.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/clients/SingleRecordFiller.java
Fri Feb 25 09:17:27 2011
@@ -116,7 +116,7 @@ public class SingleRecordFiller implemen
withSecIndexColumn, withNonIndexedColumn);
WisconsinFiller.dropTable(c, tableName);
s.executeUpdate(
- "CREATE TABLE " + tableName + "(ID INT PRIMARY KEY, " +
+ "CREATE TABLE " + tableName + "(ID INT NOT NULL, " +
(withSecIndexColumn ? "SEC INT, " : "") +
(withNonIndexedColumn ? "NI INT, " : "") +
"TEXT " + dataTypeString + "(" + TEXT_SIZE + "))");
@@ -172,6 +172,9 @@ public class SingleRecordFiller implemen
}
}
+ s.executeUpdate("ALTER TABLE " + tableName + " ADD CONSTRAINT " +
+ tableName + "_PK PRIMARY KEY (ID)");
+
if (withSecIndexColumn) {
s.executeUpdate(
"CREATE INDEX " + tableName + "_SECONDARY_INDEX ON " +
|