提交 e16e2c6d authored 作者: Thomas Mueller's avatar Thomas Mueller

New feature INSERT INTO ... DIRECT SELECT, mainly to speed up loading tables from a CSV file.

上级 19e2c32e
......@@ -43,9 +43,13 @@ SELECT * FROM (SELECT ID, COUNT(*) FROM TEST
"Commands (DML)","INSERT","
INSERT INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select }
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select }
","
Inserts a new row / new rows into a table.
When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step.
When using SORTED, b-tree pages are split at the insertion point. This can improve performance and reduce disk usage.
","
INSERT INTO TEST VALUES(1, 'Hello')
"
......
......@@ -921,6 +921,9 @@ public class Parser {
read("INTO");
Table table = readTableOrView();
command.setTable(table);
if (readIf("DIRECT")) {
command.setInsertFromSelect(true);
}
if (readIf("SORTED")) {
command.setSortedInsertMode(true);
}
......@@ -2277,7 +2280,6 @@ public class Parser {
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, databaseName);
}
schema = objectName;
objectName = name;
return readFunction(database.getSchema(schema), name);
} else if (readIf(".")) {
String databaseName = schema;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论