title: Query performance: Query on multiple tables Vs. Composite query
body: <p>Table A has column <code>srno</code> and few other columns.</p>
  
  <p>Table B has columns <code>srno</code> and <code>id</code>.</p>
  
  <p>I want to get <code>srno</code> from B for given <code>id</code> and then fetch out record(s) for that <code>srno</code> from table A.</p>
  
  <p>For example, if id is 7 then I can think of doing this by two ways:</p>
  
  <pre><code>select * from A as table_a, B as table_b where table_a.srno=table_b.srno and table_b.id=7;
  </code></pre>
  
  <p>And,</p>
  
  <pre><code>select * from A where srno in (select srno from B where id=7);
  </code></pre>
  
  <p>Both are doing same. But when there are huge number of records in both the tables, performance wise which is better? Or both would have same performance? (Let's assume here that proper indexing etc has been taken care on these two tables. I just want performance comparison between these two queries)</p>