提交 94a2a328 authored 作者: Thomas Mueller's avatar Thomas Mueller

Optimization index conditions of the form 'column=NULL'

上级 1db17c7a
......@@ -20,9 +20,10 @@ import org.h2.table.IndexColumn;
import org.h2.table.Table;
import org.h2.util.ObjectArray;
import org.h2.value.Value;
import org.h2.value.ValueNull;
/**
* The filter used to walk through an index. This class filters supports IN(..)
* The filter used to walk through an index. This class supports IN(..)
* and IN(SELECT ...) optimizations.
*/
public class IndexCursor implements Cursor {
......@@ -102,6 +103,10 @@ public class IndexCursor implements Cursor {
end = getSearchRow(end, id, v, false);
}
if (isStart && isEnd) {
if (v == ValueNull.INSTANCE) {
// join on a column=NULL is always false
alwaysFalse = true;
}
// an X=? condition will produce less rows than
// an X IN(..) condition
inColumn = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论