This famous paper about finding Access Path in Relational Database Management System by Selinger et al. says the following about criteria tree and predicates (at the end of 3rd section).

A sargable predicate is one of the form (or which can be put into the form) "column comparison-operator value". SARGS are expressed as a boolean expression of such predicates in disjunctive normal form.

My question would be, what is the significance of DNF here? Why exactly does being in DNF qualify a predicate to be a SARGABLE? Do the authors mean the following?

select ... from A join B on A.Id = B.Id where (A.F1 = 100 and A.F2 = 200) or (B.F1 = 1 and B.F2 = 2)

If so, isn't it a worst form to decide which to access first and do push down? Isn't full Disjunction the best form that it can be?

select ... from A join B on A.Id = B.Id where (A.F1 = 100 and A.F2 = 200) and (B.F1 = 1 and B.F2 = 2)
  • 2
    Did you mean to write a different query as the second? If yes, at least I can't see a difference. Dec 4, 2019 at 13:41
  • DNF is a canonical form; if a predicate can be converted to a canonical DNF it can be SARGable. Both your examples are in DNF, by the way.
    – mustaccio
    Dec 4, 2019 at 13:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.