title: LEFT JOIN runs very slowly, but nested select does not
body: <p>I heard, that JOINS are more efficient, but when i try to implement it, then SELECT is stuck in executing.</p>
  
  <p>I'm using MySQL and I have two tables filled with 100,000 records with a for loop.</p>
  
  <pre><code>CREATE TABLE `offers` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(`id`)
  );
  
  CREATE TABLE `files` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `object_id` int(11) NOT NULL,
    PRIMARY KEY(`id`)
  );
  </code></pre>
  
  <p>And following query takes 0,3s to execute:</p>
  
  <pre><code>SELECT o.id, (SELECT f.path FROM `files` AS f WHERE f.object_id = o.id LIMIT 1) as path FROM `offers` AS o;
  </code></pre>
  
  <p>But, this query which is working when files table is almost empty in exactly the same way. But when i fill files table, executing never finished.</p>
  
  <pre><code>SELECT o.id, f.path FROM `offers` o LEFT OUTER JOIN `files` f ON f.object_id = o.id
  </code></pre>
  
  <p>What i'm doing wrong?</p>