title: MSSQL and PDO very slow
body: <p>I am looking for a solution for this since days. Found nothing that worked...</p>
  
  <p>I am working on a (cake) php application.
  On my local machine, I have a mysql database. When i connect to this database, my queries are fast.</p>
  
  <p>When I execute the same code on the server, which is a Microsoft Server 2008 with MSSQL, my queries are really slow.</p>
  
  <p>Here a little test which specifies the problem best:</p>
  
  <pre><code>$attrs = array(PDO::ATTR_PERSISTENT =&gt; true);
  
  $dsn = 'sqlsrv:server=127.0.0.1;Database=xxx_art_collection';
  $user = 'xxx';
  $password = 'xxx';
  
  $start_time=microtime(true);
  try {
      $dbh = new PDO($dsn, $user, $password, $attrs);
  
      $statement = $dbh-&gt;prepare("select * from items where id&lt;10000");
      $statement-&gt;execute();
  
      //$rows = $statement-&gt;fetchAll(PDO::FETCH_ASSOC);
      //print_r($rows);
  
      while ($row = $statement-&gt;fetch(PDO::FETCH_ASSOC)) {
          print_r($row['id']);
      }
  
  } catch (PDOException $e) {
      echo 'Connection failed: ' . $e-&gt;getMessage();
  }
  $stop_time=microtime(true);
  print_r('&lt;br /&gt;'.number_format($stop_time-$start_time,4));
  </code></pre>
  
  <p>I have about 1000 entries and my measured time is around 50 seconds....
  On mysql its about 0.1 seconds...</p>
  
  <p>Thanks for an help...</p>