title: What is more performant in SQL DELETE twice or DELETE with OR?
body: <p>What is more performant in SQL <code>DELETE</code> twice or <code>DELETE</code> with <code>OR</code>?</p>
  
  <p>In my case I have two options.</p>
  
  <p>1</p>
  
  <pre><code>        DELETE FROM [dbo].[LegalContractorTemps] WHERE [Code] IS NULL;
  
          DELETE FROM [dbo].[LegalContractorTemps]
          WHERE [Id] IN (
              SELECT [Id]
              FROM [dbo].[LegalContractorTemps] [Temp]
              JOIN (
                  SELECT [Code], [Status], MAX([Id]) as [MaxId]
                  FROM [dbo].[LegalContractorTemps]
                  GROUP BY [Code], [Status]
                  HAVING COUNT([Id]) &gt; 1
              ) [TempGroup]
              ON ([Temp].[Code] = [TempGroup].[Code] AND [Temp].[Status] = [TempGroup].[Status] AND [MaxId] != [Id])
          );
  </code></pre>
  
  <p>2</p>
  
  <pre><code>        DELETE FROM [dbo].[LegalContractorTemps]
          WHERE ([Code] IS NULL) OR [Id] IN (
              SELECT [Id]
              FROM [dbo].[LegalContractorTemps] [Temp]
              JOIN (
                  SELECT [Code], [Status], MAX([Id]) as [MaxId]
                  FROM [dbo].[LegalContractorTemps]
                  GROUP BY [Code], [Status]
                  HAVING COUNT([Id]) &gt; 1
              ) [TempGroup]
              ON ([Temp].[Code] = [TempGroup].[Code] AND [Temp].[Status] = [TempGroup].[Status] AND [MaxId] != [Id])
          );
  </code></pre>
  
  <p>The <code>Code</code> and <code>Status</code> form a unique index in this case. I am using SQL Server.</p>
  
  <p>Should I go with 1 or 2?</p>