提交 7a335faf authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation.

上级 fb8a7d79
......@@ -524,29 +524,33 @@ CREATE SEQUENCE SEQ_ID
"
"Commands (DDL)","CREATE TABLE","
CREATE [ CACHED | MEMORY | TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ]
name { { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
{ { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
| { AS select } }
[ ENGINE tableEngineName ] [ NOT PERSISTENT ]
","
Creates a new table.
Cached tables (the default) are persistent, and the number of rows is not limited by the main memory.
Memory tables are persistent, but the index data is kept in main memory,
Cached tables (the default for regular tables) are persistent,
and the number of rows is not limited by the main memory.
Memory tables (the default for temporary tables) are persistent,
but the index data is kept in main memory,
that means memory tables should not get too large.
Temporary tables are deleted when closing or opening a database.
Temporary tables can be global (accessible by all connections)
or local (only accessible by the current connection).
The default for temporary tables is global.
Indexes of temporary tables are kept fully in main memory,
unless the temporary table is created using CREATE CACHED ... TABLE.
The ENGINE option is only required when custom table implementations are used.
The table engine class must implement the interface org.h2.api.TableEngine.
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
rows are lost when the database is closed.
Temporary tables are not persistent. Temporary tables can be global (accessible by all connections)
or local (only accessible by the current connection). The default is for temporary tables is global.
Indexes of temporary tables are kept fully in main memory.
This command commits an open transaction.
","
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))
......@@ -1052,17 +1056,23 @@ SET DEFAULT_TABLE_TYPE MEMORY
"
"Commands (Other)","SET EXCLUSIVE","
SET EXCLUSIVE { TRUE | FALSE }
SET EXCLUSIVE { 0 | 1 | 2 }
","
Switched the database to exclusive mode and back. In exclusive mode, new
connections are rejected, and operations by other connections are paused until
the exclusive mode is disabled. Only the connection that set the exclusive mode
can disable it. When the connection is closed, it is automatically disabled.
Switched the database to exclusive mode (1, 2) and back to normal mode (0).
In exclusive mode, new connections are rejected, and operations by
other connections are paused until the exclusive mode is disabled.
When using the value 1, existing connections stay open.
When using the value 2, all existing connections are closed
(and current transactions are rolled back) except the connection
that executes SET EXCLUSIVE.
Only the connection that set the exclusive mode can disable it.
When the connection is closed, it is automatically disabled.
Admin rights are required to execute this command.
This command commits an open transaction.
","
SET EXCLUSIVE TRUE
SET EXCLUSIVE 1
"
"Commands (Other)","SET IGNORECASE","
......
......@@ -273,9 +273,9 @@ From this point on, the operations will be executed only on one server until the
is back up.
</p><p>
Clustering can only be used in the server mode (the embedded mode does not support clustering).
It is possible to restore the cluster without stopping the server, however it is critical that no other
application is changing the data in the first database while the second database is restored, so
restoring the cluster is currently a manual process.
The cluster can be re-created using the <code>CreateCluster</code> tool without stopping
the remaining server. Applications that are still connected are automatically disconnected,
however when appending <code>;AUTO_RECONNECT=TRUE</code>, they will recover from that.
</p><p>
To initialize the cluster, use the following steps:
</p>
......
......@@ -18,8 +18,19 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>The CreateCluster tool now sets the source database in exclusive mode
<ul><li>Cluster: after a cluster node failed, the second cluster node can now be re-created
and started without having to stop the first cluster node, and without having to stop
running applications. To do that, append ;AUTO_RECONNECT=TRUE to the database URL.
</li><li>SET EXCLUSIVE now supports 0 (disable), 1 (enable), and 2 (enable and close all other connections).
</li><li>Installing the H2 as a service should now work on Windows 7.
The batch files now explicitly set the directory using pushd "%~dp0".
</li><li>Temporary tables can now be 'cached', that means indexes of temporary tables
can be persisted. This enables very large temporary tables (both local and global).
</li><li>The CreateCluster tool now sets the source database in exclusive mode
before copying data to the new database.
</li><li>The H2 Console now stream results one statement / result set at a time (using chunked transfer encoding).
To disable, set the system property h2.consoleStream to false.
This feature is not supported when using a servlet container.
</li><li>The H2 Console did not call the CreateCluster tool with the correctly escaped parameters.
</li><li>Improved PostgreSQL compatibility for ALTER TABLE ALTER COLUMN.
</li><li>Commas at the end of INSERT ... VALUES (), (), are now supported.
......
......@@ -1106,6 +1106,7 @@ or the SQL statement <code>SET MODE PostgreSQL</code>.
The auto-reconnect feature causes the JDBC driver to reconnect to
the database if the connection is lost. The automatic re-connect only
occurs when auto-commit is enabled; if auto-commit is disabled, an exception is thrown.
To enable this mode, append <code>;AUTO_RECONNECT=TRUE</code> to the database URL.
</p>
<p>
Re-connecting will open a new session. After an automatic re-connect,
......@@ -1118,7 +1119,7 @@ contains all client side state that is re-created.
<p>
Multiple processes can access the same database without having to start the server manually.
To do that, append <code>;AUTO_SERVER=TRUE</code> to the database URL.
You can use the same database URL no matter if the database is already open or not.
You can use the same database URL independent of whether the database is already open or not.
</p>
<p>
When using this mode, the first connection to the database is made in embedded mode,
......@@ -1371,7 +1372,7 @@ in <code>TestMultiDimension.java</code>.
<h3>Using Secure Passwords</h3>
<p>
Remember that weak passwords can be broken no matter of the encryption and security protocol.
Remember that weak passwords can be broken regardless of the encryption and security protocols.
Don't use passwords that can be found in a dictionary. Also appending numbers does not make them
secure. A way to create good passwords that can be remembered is, take the first
letters of a sentence, use upper and lower case characters, and creatively include special characters.
......@@ -1685,6 +1686,7 @@ The amount of memory used for caching can be changed using the setting
<code>CACHE_SIZE</code>. This setting can be set in the database connection URL
(<code>jdbc:h2:~/test;CACHE_SIZE=131072</code>), or it can be changed at runtime using
<code>SET CACHE_SIZE size</code>.
The size of the cache, as represented by <code>CACHE_SIZE</code> is measured in KB, with each KB being 1024 bytes.
This setting has no effect for in-memory databases.
</p><p>
Also included is an experimental second level soft reference cache. Rows in this cache are only garbage collected
......
......@@ -120,6 +120,9 @@ via PayPal:
</li><li>Glenn Kidd, USA
</li><li>Gustav Trede, Sweden
</li><li>Joonas Pulakka, Finland
</li><li>Bjorn Darri Sigurdsson, Iceland
</li><li>Iyama Jun, Japan
</li><li>Gray Watson, USA
</li></ul>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......
......@@ -214,7 +214,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Run benchmarks with JDK 1.5, JDK 1.6, java -server
</li><li>Optimizations: faster hash function for strings, byte arrays
</li><li>DatabaseEventListener: callback for all operations (including expected time, RUNSCRIPT) and cancel functionality
</li><li>H2 Console / large result sets: use 'streaming' instead of building the page in-memory
</li><li>Benchmark: add a graph to show how databases scale (performance/database size)
</li><li>Implement a SQLData interface to map your data over to a custom object
</li><li>In the MySQL and PostgreSQL mode, use lower case identifiers by default (DatabaseMetaData.storesLowerCaseIdentifiers = true)
......@@ -460,6 +459,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Issue 156: Support SELECT ? UNION SELECT ?.
</li><li>Automatic mixed mode: support a port range list (to avoid firewall problems).
</li><li>Support the pseudo column rowid, oid, _rowid_.
</li><li>H2 Console / large result sets: stream early instead of keeping a whole result in-memory
</li><li>Support TRUNCATE for linked tables.
</li><li>UNION: evaluate INTERSECT before UNION (like most other database except Oracle).
</li><li>Delay creating the information schema, and share metadata columns.
......@@ -483,6 +483,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Maybe use a different page layout: keep the data at the head of the page, and ignore the tail
(don't store / read it). This may increase write / read performance depending on the file system.
</li><li>Indexes of temporary tables are currently kept in-memory. Is this how it should be?
</li><li>The Shell tool should support the same built-in commands as the H2 Console.
</li></ul>
<h2>Not Planned</h2>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -180,9 +180,9 @@ CREATE SEQUENCE [ IF NOT EXISTS ] newSequenceName [ START WITH long ]
","
Creates a new sequence."
"Commands (DDL)","CREATE TABLE","
CREATE [ CACHED | MEMORY | TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ]
name { { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
{ { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
| { AS select } }
[ ENGINE tableEngineName ] [ NOT PERSISTENT ]
","
......@@ -363,9 +363,9 @@ SET DEFAULT_TABLE_TYPE { MEMORY | CACHED }
","
Sets the default table storage type that is used when creating new tables."
"Commands (Other)","SET EXCLUSIVE","
SET EXCLUSIVE { TRUE | FALSE }
SET EXCLUSIVE { 0 | 1 | 2 }
","
Switched the database to exclusive mode and back."
Switched the database to exclusive mode (1, 2) and back to normal mode (0)."
"Commands (Other)","SET IGNORECASE","
SET IGNORECASE { TRUE | FALSE }
","
......
create memory temp table test(name varchar primary key);
select index_class from information_schema.indexes where table_name = 'TEST';
> org.h2.index.TreeIndex;
drop table test;
create cached temp table test(name varchar primary key);
select index_class from information_schema.indexes where table_name = 'TEST';
> org.h2.index.PageBtreeIndex;
drop table test;
create table test(id int);
alter table test alter column id set default 'x';
select column_default from information_schema.columns c where c.table_name = 'TEST' and c.column_name = 'ID';
......
......@@ -641,4 +641,5 @@ stdio printf jchar sizeof stdlib jbyte jint uint ujlong typedef jdouble stdint
jfloat wchar hotspot jvoid std ujint jlong vars jboolean calloc argc strlen
equivalent synchronizes sullivan surname doe stepan getstart rojas snprintf
pulakka pagination collide visual aejaks simulation joonas finland minneapolis
determine timestampdiff harmony doap shortdesc wireless
\ No newline at end of file
determine timestampdiff harmony doap shortdesc wireless iceland sigurdsson
darri chunks bjorn chunked watson regardless usefulinc represented pushd
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论