title: Sql Azure - maxing DTU Percentage querying a 'empty table'
body: <p>I have been having trouble with a database for the last month or so... (it was fine in November).
  (S0 Standard tier - not even the lowest tier.) - <strong>Fixed in update 5</strong></p>
  
  <p>Select statements are causing my database to throttle (timeout even). 
  To makes sure it wasn't just a problem with my database, Ive:</p>
  
  <ol>
  <li>Copied the database... same problem on both (unless increasing the tier size).</li>
  <li><strong>Deleted the database, and created the database again</strong> (blank database) from entity framework code-first</li>
  </ol>
  
  <p>The second one proved more interesting. Now my database has 'no' data, and it still peaks the DTU and makes things unresponsive. </p>
  
  <p><img src="https://i.stack.imgur.com/CBKCm.png" alt="100% dtu resolution"></p>
  
  <p>Firstly ... is this normal? </p>
  
  <p>I do have more complicated databases at work that use about 10% max of the dtu at the same level (s0). So i'm perplexed. This is just one user, one database and currently empty, and I can make it unresponsive. </p>
  
  <p>Update 2: 
  From the copy ("the one with data 10000~ records"). I upgraded it to standard S2 (5x more powerful than s0 potentially. No problems. 
  Down-graded it to S0 again and </p>
  
  <p>SET STATISTICS IO ON
  SET STATISTICS TIME ON
  select * from Competitions -- 6 records here...</p>
  
  <p>SQL Server parse and compile time: 
     CPU time = 0 ms, elapsed time = 1 ms.</p>
  
  <p>SQL Server Execution Times:
     CPU time = 0 ms,  elapsed time = 0 ms.</p>
  
  <p>SQL Server Execution Times:
     CPU time = 0 ms,  elapsed time = 0 ms.</p>
  
  <pre><code>(6 row(s) affected)
  </code></pre>
  
  <p>Table 'Competitions'. Scan count 1, logical reads 3, physical reads 1, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</p>
  
  <p>SQL Server Execution Times:
     CPU time = 407 ms,  elapsed time = <strong>21291 ms.</strong></p>
  
  <p>Am i miss understanding azure databases, that they need to keep warming up? If i run the same query again it will be immediate. If i close the connection and do it again its back to ~20 seconds. </p>
  
  <p>Update 3:
  s1 level and it does the same query above for the first time at ~1 second</p>
  
  <p>Update 4:
  s0 level again ... first query... </p>
  
  <pre><code>(6 row(s) affected)
  </code></pre>
  
  <p>Table 'Competitions'. Scan count 1, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</p>
  
  <p>SQL Server Execution Times:
     CPU time = 16 ms,  elapsed time = 35 ms.</p>
  
  <p>Nothing is changing on these databases apart from the tier. After roaming around on one of my live sites (different database, schema and data) on s0 ... it peaked at 14.58% (its a stats site) </p>
  
  <p>Its not my best investigation. But im tired :D 
  I can give more updates if anyone is curious. </p>
  
  <p>** Update: 5 - fixed sort of **</p>
  
  <p><img src="https://i.stack.imgur.com/afnk4.png" alt="enter image description here"></p>
  
  <p>The first few 100% spikes were the same table. After updating the schema and removing a geography field (the data was null in that column) it has moved to the later smaller peaks ~1-4% and a result time back in the very low ms. </p>
  
  <p>Thanks for the help, 
  Matt</p>