title: How much is performance improved when using LIMIT in a SQL sentence?
body: <p>Let's suppose I have a table in my database with <code>1.000.000</code> records.</p>
  
  <p>If I execute:</p>
  
  <pre><code>SELECT * FROM [Table] LIMIT 1000
  </code></pre>
  
  <p>Will this query take the same time as if I have that table with <code>1000</code> records and just do:</p>
  
  <pre><code>SELECT * FROM [Table]
  </code></pre>
  
  <p>?</p>
  
  <p>I'm not looking for if it will take exactly the same time. I just want to know if the first one will take much more time to execute than the second one.</p>
  
  <p>I said <code>1.000.000</code> records, but it could be <code>20.000.000</code>. That was just an example.</p>
  
  <p><strong>Edit:</strong><br>
  Of course that when using LIMIT and without using it in the same table, the query built using LIMIT should be executed faster, but I'm not asking that...</p>
  
  <p><strong>To make it generic:</strong>  </p>
  
  <p><code>Table1</code>: <code>X</code> records<br>
  <code>Table2</code>: <code>Y</code> records</p>
  
  <p><code>(X &lt;&lt; Y)</code></p>
  
  <p>What I want to compare is:</p>
  
  <p><code>SELECT * FROM Table1</code>  </p>
  
  <p>and  </p>
  
  <p><code>SELECT * FROM Table2 LIMIT X</code>  </p>
  
  <p><strong>Edit 2:</strong><br>
  <strong>Here is why I'm asking this:</strong></p>
  
  <p>I have a database, with 5 tables and relationships between some of them. One of those tables will (I'm 100% sure) contain about <code>5.000.000</code> records. I'm using SQL Server CE 3.5, Entity Framework as the ORM and LINQ to SQL to make the queries.</p>
  
  <p>I need to perform basically three kind of non-simple queries, and I was thinking about showing to the user a limit of records (just like lot of websites do). If the user wants to see more records, the option he/she has is to restrict more the search.</p>
  
  <p>So, the question came up because I was thinking about doing this (limiting to <code>X</code> records per query) or if storing in the database only <code>X</code> results (the recent ones), which will require to do some deletions in the database, but I was just thinking...</p>
  
  <p>So, that table could contain <code>5.000.000</code> records or more, and what I don't want is to show the user <code>1000</code> or so, and even like this, the query still be as slow as if it would be returning the <code>5.000.000</code> rows.</p>