title: Serializable transaction deadlock
body: <p>Documentation says, <code>serializable</code> transactions execute one after one.</p>
  
  <p>But in practic it seems not to be truth. Here's two almost equal transactions, the difference is delay for 15 seconds only. </p>
  
  <p>#1:</p>
  
  <pre><code>set transaction isolation level serializable
  go
  begin transaction
  if not exists (select * from articles where title like 'qwe')
  begin
  waitfor delay '00:00:15'
  insert into articles (title) values ('qwe')
  end
  commit transaction go
  </code></pre>
  
  <p>#2:</p>
  
  <pre><code>set transaction isolation level serializable
  go
  begin transaction
  if not exists (select * from articles where title like 'qwe')
  begin
  insert into articles (title) values ('asd')
  end
  commit transaction go
  </code></pre>
  
  <p>The second transaction has been run after couple of seconds since the start of first one.</p>
  
  <p>The result is deadlock. The first transaction dies with </p>
  
  <pre><code>Transaction (Process ID 58) was deadlocked on 
  lock resources with another process and has been chosen as the deadlock victim. 
  Rerun the transaction.
  </code></pre>
  
  <p>reason.</p>
  
  <p>The conclusion, serializable transactions are not serial?</p>