 (defn- where-plan [db where order]
   (let [[op & wrest] where]
     (cond
+      ; only choice -> optimal
       (not op)
         (root-plan db order)
 
+      ; only simple choice -> probably optimal
       (= :!= op)
         (root-filter-plan db where order)
 
+      ; when no index, use root-filter-plan -> optimal
+      ; when reasonable index and no order -> probably optimal
+      ; when reasonable index and order -> may be suboptimal, but reasonable
       (= := op)
         (let [[attr aval] wrest]
           (if (index-on db attr)

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

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

           :ordered (:ordered main-plan)
           :source  main-plan})

      ; meh -> fair but not great
      (= :or op)
        (let [sub-plans (map #(where-plan db % order) wrest)]
          {:action  :union
