提交 755bd88a authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 e4877c9c
......@@ -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
......@@ -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 $@
......@@ -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.
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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)
......
......@@ -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>
&lt;context-param>
&lt;param-name>db.url&lt;/param-name>
&lt;param-value>jdbc:h2:~/test&lt;/param-value>
&lt;/context-param>
&lt;context-param>
&lt;param-name>db.user&lt;/param-name>
&lt;param-value>sa&lt;/param-value>
&lt;/context-param>
&lt;context-param>
&lt;param-name>db.password&lt;/param-name>
&lt;param-value>sa&lt;/param-value>
&lt;/context-param>
&lt;context-param>
&lt;param-name>db.tcpServer&lt;/param-name>
&lt;param-value>-tcpAllowOthers&lt;/param-value>
&lt;/context-param>
</pre>
<br /><a name="csv"></a>
<h2>CSV (Comma Separated Values) Support</h2>
......
......@@ -46,7 +46,7 @@ public class DbStarter implements ServletContextListener {
server = Server.createTcpServer(params);
server.start();
}
// To access the database using the server, use the URL:
// To access the database in server mode, use the database URL:
// jdbc:h2:tcp://localhost/~/test
} catch (Exception e) {
......
......@@ -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("-----------------------------------------");
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论