Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e64ccfd2
提交
e64ccfd2
authored
8月 04, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete old databases before testing; small formatting changes; use standard statements.
上级
5dbcd675
全部展开
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
175 行增加
和
96 行删除
+175
-96
BenchC.java
h2/src/test/org/h2/test/bench/BenchC.java
+161
-68
BenchCThread.java
h2/src/test/org/h2/test/bench/BenchCThread.java
+10
-21
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+4
-7
没有找到文件。
h2/src/test/org/h2/test/bench/BenchC.java
浏览文件 @
e64ccfd2
差异被折叠。
点击展开。
h2/src/test/org/h2/test/bench/BenchCThread.java
浏览文件 @
e64ccfd2
...
@@ -131,14 +131,9 @@ public class BenchCThread {
...
@@ -131,14 +131,9 @@ public class BenchCThread {
int
oId
=
rs
.
getInt
(
1
)
-
1
;
int
oId
=
rs
.
getInt
(
1
)
-
1
;
BigDecimal
tax
=
rs
.
getBigDecimal
(
2
);
BigDecimal
tax
=
rs
.
getBigDecimal
(
2
);
rs
.
close
();
rs
.
close
();
// TODO optimizer: such cases can be optimized! A=1 AND B=A means
// also B=1!
// prep = prepare("SELECT C_DISCOUNT, C_LAST, C_CREDIT, W_TAX "
// + "FROM CUSTOMER, WAREHOUSE "
// + "WHERE C_ID=? AND W_ID=? AND C_W_ID=W_ID AND C_D_ID=?");
prep
=
prepare
(
"SELECT C_DISCOUNT, C_LAST, C_CREDIT, W_TAX "
prep
=
prepare
(
"SELECT C_DISCOUNT, C_LAST, C_CREDIT, W_TAX "
+
"FROM CUSTOMER, WAREHOUSE "
+
"FROM CUSTOMER, WAREHOUSE "
+
"WHERE C_ID=? AND
C_
W_ID=? AND C_W_ID=W_ID AND C_D_ID=?"
);
+
"WHERE C_ID=? AND W_ID=? AND C_W_ID=W_ID AND C_D_ID=?"
);
prep
.
setInt
(
1
,
cId
);
prep
.
setInt
(
1
,
cId
);
prep
.
setInt
(
2
,
warehouseId
);
prep
.
setInt
(
2
,
warehouseId
);
prep
.
setInt
(
3
,
dId
);
prep
.
setInt
(
3
,
dId
);
...
@@ -695,27 +690,21 @@ public class BenchCThread {
...
@@ -695,27 +690,21 @@ public class BenchCThread {
rs
.
next
();
rs
.
next
();
int
oId
=
rs
.
getInt
(
1
);
int
oId
=
rs
.
getInt
(
1
);
rs
.
close
();
rs
.
close
();
// prep = prepare("SELECT COUNT(DISTINCT S_I_ID) "
// + "FROM ORDER_LINE, STOCK WHERE OL_W_ID=? AND "
// + "OL_D_ID=? AND OL_O_ID<? AND "
// + "OL_O_ID>=?-20 AND S_W_ID=? AND "
// + "S_I_ID=OL_I_ID AND S_QUANTITY<?");
// prep.setInt(1, warehouseId);
// prep.setInt(2, d_id);
// prep.setInt(3, o_id);
// prep.setInt(4, o_id);
prep
=
prepare
(
"SELECT COUNT(DISTINCT S_I_ID) "
prep
=
prepare
(
"SELECT COUNT(DISTINCT S_I_ID) "
+
"FROM ORDER_LINE, STOCK WHERE OL_W_ID=? AND "
+
"FROM ORDER_LINE, STOCK WHERE "
+
"OL_D_ID=? AND OL_O_ID<? AND "
+
"OL_W_ID=? AND "
+
"OL_O_ID>=? AND S_W_ID=? AND "
+
"OL_D_ID=? AND "
+
"S_I_ID=OL_I_ID AND S_QUANTITY<?"
);
+
"OL_O_ID<? AND "
+
"OL_O_ID>=?-20 AND "
+
"S_W_ID=? AND "
+
"S_I_ID=OL_I_ID AND "
+
"S_QUANTITY<?"
);
prep
.
setInt
(
1
,
warehouseId
);
prep
.
setInt
(
1
,
warehouseId
);
prep
.
setInt
(
2
,
dId
);
prep
.
setInt
(
2
,
dId
);
prep
.
setInt
(
3
,
oId
);
prep
.
setInt
(
3
,
oId
);
prep
.
setInt
(
4
,
oId
-
20
);
prep
.
setInt
(
4
,
oId
);
prep
.
setInt
(
5
,
warehouseId
);
prep
.
setInt
(
5
,
warehouseId
);
prep
.
setInt
(
6
,
threshold
);
prep
.
setInt
(
6
,
threshold
);
// TODO this is where HSQLDB is very slow
rs
=
db
.
query
(
prep
);
rs
=
db
.
query
(
prep
);
rs
.
next
();
rs
.
next
();
// stockCount
// stockCount
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
e64ccfd2
...
@@ -19,6 +19,7 @@ import java.sql.Statement;
...
@@ -19,6 +19,7 @@ import java.sql.Statement;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.h2.store.fs.FileSystem
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
...
@@ -53,15 +54,12 @@ public class TestPerformance {
...
@@ -53,15 +54,12 @@ public class TestPerformance {
return
DriverManager
.
getConnection
(
"jdbc:h2:data/results"
);
return
DriverManager
.
getConnection
(
"jdbc:h2:data/results"
);
}
}
private
void
openResults
(
boolean
init
)
throws
SQLException
{
private
void
openResults
()
throws
SQLException
{
Connection
conn
=
null
;
Connection
conn
=
null
;
Statement
stat
=
null
;
Statement
stat
=
null
;
try
{
try
{
conn
=
getResultConnection
();
conn
=
getResultConnection
();
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
if
(
init
)
{
stat
.
execute
(
"DROP TABLE IF EXISTS RESULTS"
);
}
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS RESULTS(TESTID INT, TEST VARCHAR, "
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS RESULTS(TESTID INT, TEST VARCHAR, "
+
"UNIT VARCHAR, DBID INT, DB VARCHAR, RESULT VARCHAR)"
);
+
"UNIT VARCHAR, DBID INT, DB VARCHAR, RESULT VARCHAR)"
);
}
finally
{
}
finally
{
...
@@ -71,7 +69,6 @@ public class TestPerformance {
...
@@ -71,7 +69,6 @@ public class TestPerformance {
}
}
private
void
test
(
String
[]
args
)
throws
Exception
{
private
void
test
(
String
[]
args
)
throws
Exception
{
boolean
init
=
false
;
int
dbId
=
-
1
;
int
dbId
=
-
1
;
boolean
exit
=
false
;
boolean
exit
=
false
;
String
out
=
"benchmark.html"
;
String
out
=
"benchmark.html"
;
...
@@ -80,7 +77,7 @@ public class TestPerformance {
...
@@ -80,7 +77,7 @@ public class TestPerformance {
if
(
"-db"
.
equals
(
arg
))
{
if
(
"-db"
.
equals
(
arg
))
{
dbId
=
Integer
.
parseInt
(
args
[++
i
]);
dbId
=
Integer
.
parseInt
(
args
[++
i
]);
}
else
if
(
"-init"
.
equals
(
arg
))
{
}
else
if
(
"-init"
.
equals
(
arg
))
{
init
=
true
;
FileSystem
.
getInstance
(
"data"
).
deleteRecursive
(
"data"
)
;
}
else
if
(
"-out"
.
equals
(
arg
))
{
}
else
if
(
"-out"
.
equals
(
arg
))
{
out
=
args
[++
i
];
out
=
args
[++
i
];
}
else
if
(
"-trace"
.
equals
(
arg
))
{
}
else
if
(
"-trace"
.
equals
(
arg
))
{
...
@@ -127,7 +124,7 @@ public class TestPerformance {
...
@@ -127,7 +124,7 @@ public class TestPerformance {
Statement
stat
=
null
;
Statement
stat
=
null
;
PrintWriter
writer
=
null
;
PrintWriter
writer
=
null
;
try
{
try
{
openResults
(
init
);
openResults
();
conn
=
getResultConnection
();
conn
=
getResultConnection
();
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
prep
=
conn
prep
=
conn
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论