              :ordered false}
             (root-filter-plan db where order)))
 
+      ; as above
       (= :in op)
         (let [[attr in] wrest]
           (if (index-on db attr)

(defn- where-plan [db where order]
  (let [[op & wrest] where]
    (cond
      (not op)
        (root-plan db order)

      (= :!= op)
        (root-filter-plan db where order)

      (= := op)
        (let [[attr aval] wrest]
          (if (index-on db attr)

               :ordered ordered})
            (root-filter-plan db where order)))

      ; when no indexes use root-filter-plan -> optimal
      ; when some reasonable, most selective first index -> probably optimal
      ; when non-index or not-most selective first -> suboptimal
      (= :and op)
        (let [main-plan     (where-plan db (first wrest) order)
              filter-wheres (next wrest)]
