例如:
select * from A where
predicate1 and
predicate2 and
predicate3;
如果predicate1返回false,程序是否会继续评估其他谓词?干杯。
答案 0 :(得分:2)
优化器可能会重新排序谓词,在一般情况下,所有谓词都将被执行:
sqlite> .explain on sqlite> explain select 1 where 11=22 and 33=44; addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Trace 0 0 0 00 1 Integer 11 3 0 00 2 Integer 22 4 0 00 3 Eq 4 2 3 72 4 Integer 33 3 0 00 5 Integer 44 5 0 00 6 Eq 5 4 3 72 7 And 4 2 1 00 8 IfNot 1 12 1 00 9 Goto 0 13 0 00 10 Integer 1 6 0 00 11 ResultRow 6 1 0 00 12 Halt 0 0 0 00 13 Goto 0 10 0 00