So, I wrote a query in Visual Studio 2010 (I mean, I opened the server explorer, right-click on the server and chose New Query). The request includes a condition
A AND B AND C AND D AND E AND F AND (G OR H)
which is a conjunctive normal form (CNF). When I ran the query (attached to MSSQL Server 2008), it changed the text to
A AND B AND C AND D AND E AND F AND G OR A AND B AND C AND D AND E AND F AND H
which is a disjunctive normal form (DNF).
From the small number I found online, it looks like DNF allows SQL to run conjunctives separately and merge them at the end.
However, for something similar, with so many repetitive conditions, does DNF really give an edge over CNF? If this is not the case, how can I make the optimizer accept the condition as is? If so, should I write the request in the application code in the form of CNF, because it is shorter and more accurate, or in the form of DNF, because it saves time for the optimizer?
source share