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

New experimental feature SHUTDOWN DEFRAG.

上级 baf17927
...@@ -507,16 +507,23 @@ public class PageStore implements CacheWriter { ...@@ -507,16 +507,23 @@ public class PageStore implements CacheWriter {
recordedPagesList = New.arrayList(); recordedPagesList = New.arrayList();
recordedPagesIndex = new IntIntHashMap(); recordedPagesIndex = new IntIntHashMap();
recordPageReads = true; recordPageReads = true;
Session s = database.getSystemSession();
for (int i = 0; i < tables.size(); i++) { for (int i = 0; i < tables.size(); i++) {
Table table = tables.get(i); Table table = tables.get(i);
if (!table.isTemporary() && table.getTableType().equals(Table.TABLE)) { if (!table.isTemporary() && table.getTableType().equals(Table.TABLE)) {
// rand() < 0 is never true, but the optimizer can't know, Index scanIndex = table.getScanIndex(s);
// therefore it's performing a table scan Cursor cursor = scanIndex.find(s, null, null);
database.getSystemSession().prepare( while (cursor.next()) {
"select * from " + cursor.get();
table.getSQL() + }
" where rand() < zero()").query(Integer.MAX_VALUE); for (Index index : table.getIndexes()) {
int todoScanIndexesAsWell; if (index != scanIndex) {
cursor = index.find(s, null, null);
while (cursor.next()) {
// the data is already read
}
}
}
} }
} }
recordPageReads = false; recordPageReads = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论