提交 1f472b54 authored 作者: Thomas Mueller's avatar Thomas Mueller

New experimental feature to speed up CREATE TABLE ... AS SELECT.

上级 164f419c
...@@ -167,6 +167,10 @@ public class Insert extends Prepared implements ResultTarget { ...@@ -167,6 +167,10 @@ public class Insert extends Prepared implements ResultTarget {
} }
} }
public int getRowCount() {
return rowNumber;
}
public String getPlanSQL() { public String getPlanSQL() {
StatementBuilder buff = new StatementBuilder("INSERT INTO "); StatementBuilder buff = new StatementBuilder("INSERT INTO ");
buff.append(table.getSQL()).append('('); buff.append(table.getSQL()).append('(');
......
...@@ -504,7 +504,7 @@ public class Select extends Query { ...@@ -504,7 +504,7 @@ public class Select extends Query {
} }
result.addRow(row); result.addRow(row);
rowNumber++; rowNumber++;
if ((sort == null || sortUsingIndex) && limitRows != 0 && rowNumber >= limitRows) { if ((sort == null || sortUsingIndex) && limitRows != 0 && result.getRowCount() >= limitRows) {
break; break;
} }
if (sampleSize > 0 && rowNumber >= sampleSize) { if (sampleSize > 0 && rowNumber >= sampleSize) {
......
...@@ -20,4 +20,11 @@ public interface ResultTarget { ...@@ -20,4 +20,11 @@ public interface ResultTarget {
*/ */
void addRow(Value[] values); void addRow(Value[] values);
/**
* Get the number of rows.
*
* @return the number of rows
*/
int getRowCount();
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论