How to fix the un-optimal behavior of query engine

Also look here: