提交 4685d322 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 7d53d8e3
...@@ -644,6 +644,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -644,6 +644,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Google Code http://code.google.com/p/h2database/issues/list# </li><li>Google Code http://code.google.com/p/h2database/issues/list#
</li><li>Simplify translation ('Donate a translation') </li><li>Simplify translation ('Donate a translation')
</li><li>Option to encrypt .trace.db file </li><li>Option to encrypt .trace.db file
</li><li>Improve create index performance
</li><li>Write Behind Cache on SATA leads to data corruption </li><li>Write Behind Cache on SATA leads to data corruption
See also http://sr5tech.com/write_back_cache_experiments.htm See also http://sr5tech.com/write_back_cache_experiments.htm
and http://www.jasonbrome.com/blog/archives/2004/04/03/writecache_enabled.html and http://www.jasonbrome.com/blog/archives/2004/04/03/writecache_enabled.html
...@@ -691,7 +692,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -691,7 +692,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Test Dezign for Databases (http://www.datanamic.com) </li><li>Test Dezign for Databases (http://www.datanamic.com)
</li><li>Fast library for parsing / formatting: http://javolution.org/ </li><li>Fast library for parsing / formatting: http://javolution.org/
</li><li>Updatable Views (simple cases first) </li><li>Updatable Views (simple cases first)
</li><li>Improve create index performance
</li><li>Support ARRAY data type </li><li>Support ARRAY data type
</li><li>Implement more JDBC 4.0 features </li><li>Implement more JDBC 4.0 features
</li><li>H2 Console: implement a servlet to allow simple web app integration </li><li>H2 Console: implement a servlet to allow simple web app integration
......
/* * Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). /*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group * Initial Developer: H2 Group
*/ */
package org.h2; package org.h2;
......
...@@ -22,6 +22,7 @@ import org.h2.index.IndexType; ...@@ -22,6 +22,7 @@ import org.h2.index.IndexType;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.schema.Schema; import org.h2.schema.Schema;
import org.h2.table.Column; import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.table.TableFilter; import org.h2.table.TableFilter;
import org.h2.util.ObjectArray; import org.h2.util.ObjectArray;
...@@ -186,7 +187,8 @@ public class AlterTableAddConstraint extends SchemaCommand { ...@@ -186,7 +187,8 @@ public class AlterTableAddConstraint extends SchemaCommand {
indexType.setBelongsToConstraint(true); indexType.setBelongsToConstraint(true);
String prefix = constraintName == null ? "CONSTRAINT" : constraintName; String prefix = constraintName == null ? "CONSTRAINT" : constraintName;
String indexName = getSchema().getUniqueIndexName(prefix + "_INDEX_"); String indexName = getSchema().getUniqueIndexName(prefix + "_INDEX_");
return t.addIndex(session, indexName, indexId, cols, indexType, Index.EMPTY_HEAD, null); IndexColumn[] idxCols = IndexColumn.wrap(cols);
return t.addIndex(session, indexName, indexId, idxCols, indexType, Index.EMPTY_HEAD, null);
} }
public void setDeleteAction(int action) { public void setDeleteAction(int action) {
......
...@@ -476,11 +476,13 @@ public class Select extends Query { ...@@ -476,11 +476,13 @@ public class Select extends Query {
condition.createIndexConditions(session, f); condition.createIndexConditions(session, f);
} }
} }
if (condition == null && isGroupQuery && groupIndex == null && havingIndex < 0 && filters.size() == 1) { if (isGroupQuery && groupIndex == null && havingIndex < 0 && filters.size() == 1) {
if (condition == null) {
ExpressionVisitor optimizable = ExpressionVisitor.get(ExpressionVisitor.OPTIMIZABLE_MIN_MAX_COUNT_ALL); ExpressionVisitor optimizable = ExpressionVisitor.get(ExpressionVisitor.OPTIMIZABLE_MIN_MAX_COUNT_ALL);
optimizable.table = ((TableFilter) filters.get(0)).getTable(); optimizable.table = ((TableFilter) filters.get(0)).getTable();
isQuickQuery = isEverything(optimizable); isQuickQuery = isEverything(optimizable);
} }
}
cost = preparePlan(); cost = preparePlan();
if (sort != null && !isQuickQuery && !isGroupQuery && !distinct) { if (sort != null && !isQuickQuery && !isGroupQuery && !distinct) {
Index index = getSortIndex(); Index index = getSortIndex();
......
...@@ -38,6 +38,7 @@ import org.h2.store.RecordReader; ...@@ -38,6 +38,7 @@ import org.h2.store.RecordReader;
import org.h2.store.Storage; import org.h2.store.Storage;
import org.h2.store.WriterThread; import org.h2.store.WriterThread;
import org.h2.table.Column; import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.MetaTable; import org.h2.table.MetaTable;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.table.TableData; import org.h2.table.TableData;
...@@ -479,7 +480,8 @@ public class Database implements DataHandler { ...@@ -479,7 +480,8 @@ public class Database implements DataHandler {
cols.add(new Column("TYPE", Value.INT, 0, 0)); cols.add(new Column("TYPE", Value.INT, 0, 0));
cols.add(new Column("SQL", Value.STRING, 0, 0)); cols.add(new Column("SQL", Value.STRING, 0, 0));
meta = mainSchema.createTable("SYS", 0, cols, persistent, false); meta = mainSchema.createTable("SYS", 0, cols, persistent, false);
metaIdIndex = meta.addIndex(systemSession, "SYS_ID", 0, new Column[] { columnId }, IndexType.createPrimaryKey( IndexColumn[] pkCols = IndexColumn.wrap(new Column[] { columnId });
metaIdIndex = meta.addIndex(systemSession, "SYS_ID", 0, pkCols, IndexType.createPrimaryKey(
false, false), Index.EMPTY_HEAD, null); false, false), Index.EMPTY_HEAD, null);
objectIds.set(0); objectIds.set(0);
// there could be views on system tables, so they must be added first // there could be views on system tables, so they must be added first
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论