title: SQLilte query much slower through RSqlite than sqlite3 command-line interface
body: <p>I'm using the RSQLite package to make queries to a local SQLite database, and for some queries the RSQLite interface is quite slow. </p>
  
  <p>As a specific example, the following query takes under one second to run using the sqlite3 command-line utility:</p>
  
  <pre><code>$ sqlite3 data/svn.db
  SQLite version 3.7.5
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite&gt; select count(distinct svn_path.revision)  FROM src INNER JOIN svn_path ON src.filename=svn_path.path;
  5039
  </code></pre>
  
  <p>But the equivalent query in R takes a little over two minutes and uses 100% of one of my CPUs:</p>
  
  <pre><code>&gt; library(RSQLite)
  Loading required package: DBI
  &gt; con &lt;- dbConnect(SQLite(), dbname="data/svn.db")
  &gt; dbGetQuery(con, "select count(distinct svn_path.revision)  FROM src INNER JOIN svn_path ON src.filename=svn_path.path")
    count(distinct svn_path.revision)
  1                              5039
  </code></pre>
  
  <p>Why is the performance so much slower through the R interface? </p>
  
  <p>Note that I'm using R64 2.10.1 on Mac OS X 10.6.6.</p>