Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
755bd88a
提交
755bd88a
authored
8月 14, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
e4877c9c
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
2087 行增加
和
1920 行删除
+2087
-1920
build.bat
h2/build.bat
+1
-1
build.sh
h2/build.sh
+1
-1
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
faq.html
h2/src/docsrc/html/faq.html
+4
-0
jaqu.html
h2/src/docsrc/html/jaqu.html
+2
-1
performance.html
h2/src/docsrc/html/performance.html
+52
-0
roadmap.html
h2/src/docsrc/html/roadmap.html
+0
-1
tutorial.html
h2/src/docsrc/html/tutorial.html
+24
-0
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+672
-636
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+678
-642
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+647
-635
DbStarter.java
h2/src/main/org/h2/server/web/DbStarter.java
+1
-1
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
Build.java
h2/src/tools/org/h2/build/Build.java
+1
-0
没有找到文件。
h2/build.bat
浏览文件 @
755bd88a
...
...
@@ -4,4 +4,4 @@ if exist bin/org/h2/build/Build.class goto buildOK
if not exist bin mkdir bin
javac -sourcepath src/tools -d bin src/tools/org/h2/build/*.java
:buildOK
java -Xmx512m -cp "bin;%JAVA_HOME%/lib/tools.jar;temp" org.h2.build.Build %*
\ No newline at end of file
"%JAVA_HOME%/bin/java" -Xmx512m -cp "bin;%JAVA_HOME%/lib/tools.jar;temp" org.h2.build.Build %*
\ No newline at end of file
h2/build.sh
浏览文件 @
755bd88a
...
...
@@ -8,4 +8,4 @@ if [ ! -f "bin/org/h2/build/Build.class" ] ; then
fi
javac
-sourcepath
src/tools
-d
bin src/tools/org/h2/build/
*
.java
fi
java
-Xmx512m
-cp
"bin:
$JAVA_HOME
/lib/tools.jar:temp"
org.h2.build.Build
$@
"
$JAVA_HOME
/bin/java"
-Xmx512m
-cp
"bin:
$JAVA_HOME
/lib/tools.jar:temp"
org.h2.build.Build
$@
h2/src/docsrc/html/changelog.html
浏览文件 @
755bd88a
...
...
@@ -16,7 +16,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
NOT IN(SELECT ...) was incorrect if the subquery returns no rows.
<ul><li>
Timestamp columns such as TIMESTAMP(6) were not compatible to other database.
</li><li>
Opening a large database was slow if there was a problem opening the previous time.
</li><li>
NOT IN(SELECT ...) was incorrect if the subquery returns no rows.
</li><li>
CREATE TABLE AS SELECT did not work correctly in the multi-version concurrency mode.
</li><li>
Support a comma before closing a list, as in: create table test(id int,)
</li><li>
MySQL compatibility: linked tables had lower case column names on some systems.
...
...
h2/src/docsrc/html/faq.html
浏览文件 @
755bd88a
...
...
@@ -111,6 +111,10 @@ Every CLOB or BLOB can be up to 256 GB as well. The size limit of the index data
The maximum file size for FAT or FAT32 file systems is 4 GB. So if you use FAT or FAT32, the
limit is 4 GB for the data.
</p>
<p>
The larger the database, the more main memory is required. Currently the mininum main memory required for a 12 GB database
is around 240 MB.
</p>
<br
/><a
name=
"reliable"
></a>
<h3>
Is it Reliable?
</h3>
...
...
h2/src/docsrc/html/jaqu.html
浏览文件 @
755bd88a
...
...
@@ -252,7 +252,8 @@ Unlike when using annotations, the compiler can check the syntax even for multi-
objects (multi-column indexes, multi-column primary keys and so on).
This solution is very flexible because the definition is written in regular Java code:
Unlike when using annotations, your code can select the right configuration depending
on the environment if required.
on the environment if required. Unlike XML mapping configuration, the configuration
is integrated in the class itself.
</p>
<h2>
Ideas
</h2>
...
...
h2/src/docsrc/html/performance.html
浏览文件 @
755bd88a
...
...
@@ -20,6 +20,8 @@ Performance
PolePosition Benchmark
</a><br
/>
<a
href=
"#application_profiling"
>
Application Profiling
</a><br
/>
<a
href=
"#database_profiling"
>
Database Profiling
</a><br
/>
<a
href=
"#database_performance_tuning"
>
Performance Tuning
</a><br
/>
...
...
@@ -290,10 +292,60 @@ Premature or 'blind' optimization should be avoided, as it is not an efficient w
There are various ways to analyze the application. In some situations it is possible to
compare two implementations and use System.currentTimeMillis() to find out which one is faster.
But this does not work for complex applications with many modules, and for memory problems.
</p>
<p>
A very good tool to measure both the memory and the CPU is the
<a
href=
"http://www.yourkit.com"
>
YourKit Java Profiler
</a>
. This tool is also used
to optimize the performance and memory footprint of this database engine.
</p>
<p>
A simple way to profile an application is to use the built-in profiling tool of java. Example:
</p>
<pre>
java -Xrunhprof:cpu=samples,depth=16 com.acme.Test
</pre>
<p>
Unfortunately, it is only possible to profile the application from start to end.
</p>
<br
/><a
name=
"database_profiling"
></a>
<h2>
Database Profiling
</h2>
<p>
The ConvertTraceFile tool generates SQL statement statistics at the end of the SQL script file.
The format used is similar to the profiling data generated when using java -Xrunhprof.
As an example, execute the the following script using the H2 Console:
</p>
<pre>
SET TRACE_LEVEL_FILE 3;
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
@LOOP 1000 INSERT INTO TEST VALUES(?, ?);
SET TRACE_LEVEL_FILE 0;
</pre>
<p>
Now convert the .trace.db file using the ConvertTraceFile tool:
</p>
<pre>
java -cp h2.jar org.h2.tools.ConvertTraceFile
-traceFile "~/test.trace.db" -script "~/test.sql"
</pre>
<p>
The generated file
<code>
test.sql
</code>
will contain the SQL statements as well as the
following profiling data (results vary):
</p>
<pre>
-----------------------------------------
-- SQL Statement Statistics
-- time: total time in milliseconds (accumulated)
-- count: how many times the statement ran
-- result: total update count or row count
-----------------------------------------
-- self accu time count result sql
-- 62% 62% 158 1000 1000 INSERT INTO TEST VALUES(?, ?);
-- 37% 100% 93 1 0 CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
-- 0% 100% 0 1 0 DROP TABLE IF EXISTS TEST;
-- 0% 100% 0 1 0 SET TRACE_LEVEL_FILE 3;
</pre>
<br
/><a
name=
"database_performance_tuning"
></a>
<h2>
Database Performance Tuning
</h2>
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
755bd88a
...
...
@@ -248,7 +248,6 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>
Support multiple directories (on different hard drives) for the same database
</li><li>
Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response
</li><li>
Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server)
</li><li>
GROUP BY and DISTINCT: support large groups (buffer to disk), do not keep large sets in memory
</li><li>
Support native XML data type
</li><li>
Support triggers with a string property or option: SpringTrigger, OSGITrigger
</li><li>
Clustering: adding a node should be very fast and without interrupting clients (very short lock)
...
...
h2/src/docsrc/html/tutorial.html
浏览文件 @
755bd88a
...
...
@@ -391,6 +391,30 @@ add the following snippet to your web.xml file (after context-param and before f
<p>
For details on how to access the database, see the code DbStarter.java
</p>
<p>
By default the DbStarter listener opens a connection using the database URL jdbc:h2:~/test
and user name and password 'sa'. It can also start the TCP server, however this is disabled by default.
To enable it, use the db.tcpServer parameter in web.xml. Here is the complete list of options.
These options are set just after the display-name and description tag, but before any listener and filter tags:
</p>
<pre>
<
context-param>
<
param-name>db.url
<
/param-name>
<
param-value>jdbc:h2:~/test
<
/param-value>
<
/context-param>
<
context-param>
<
param-name>db.user
<
/param-name>
<
param-value>sa
<
/param-value>
<
/context-param>
<
context-param>
<
param-name>db.password
<
/param-name>
<
param-value>sa
<
/param-value>
<
/context-param>
<
context-param>
<
param-name>db.tcpServer
<
/param-name>
<
param-value>-tcpAllowOthers
<
/param-value>
<
/context-param>
</pre>
<br
/><a
name=
"csv"
></a>
<h2>
CSV (Comma Separated Values) Support
</h2>
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
755bd88a
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
755bd88a
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
755bd88a
差异被折叠。
点击展开。
h2/src/main/org/h2/server/web/DbStarter.java
浏览文件 @
755bd88a
...
...
@@ -46,7 +46,7 @@ public class DbStarter implements ServletContextListener {
server
=
Server
.
createTcpServer
(
params
);
server
.
start
();
}
// To access the database
using the server, use th
e URL:
// To access the database
in server mode, use the databas
e URL:
// jdbc:h2:tcp://localhost/~/test
}
catch
(
Exception
e
)
{
...
...
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
755bd88a
...
...
@@ -175,7 +175,7 @@ public class ConvertTraceFile extends Tool {
if
(
stats
.
size
()
>
0
)
{
scriptWriter
.
println
(
"-----------------------------------------"
);
scriptWriter
.
println
(
"-- SQL Statement Statistics"
);
scriptWriter
.
println
(
"-- time: total time in milliseconds"
);
scriptWriter
.
println
(
"-- time: total time in milliseconds
(accumulated)
"
);
scriptWriter
.
println
(
"-- count: how many times the statement ran"
);
scriptWriter
.
println
(
"-- result: total update count or row count"
);
scriptWriter
.
println
(
"-----------------------------------------"
);
...
...
h2/src/tools/org/h2/build/Build.java
浏览文件 @
755bd88a
...
...
@@ -369,6 +369,7 @@ public class Build extends BuildBase {
private
void
resources
(
boolean
clientOnly
)
{
FileList
files
=
getFiles
(
"src/main"
).
exclude
(
"*.MF"
).
exclude
(
"*.java"
).
exclude
(
"*/package.html"
).
exclude
(
"*/java.sql.Driver"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论