0

アプリで SQLite を使用しています (WP 7.1 および Community.CsharpSqlite.SqlLiteClient.WP7.dll アセンブリ)。

内部結合を使用すると、SQLite DataReader オブジェクトが非常に遅くなります (リストに 1000 レコードを入力するのに約 3 ~ 5 秒かかります)。

SQLite データベースを削除して、「sdf」データベースの使用を開始することを考えています。

WP で SQLite DataReader オブジェクトが非常に遅い理由を知っている人はいますか?

これが私のサンプルコードです(table1は5000レコードと5列のテーブルです。table2にはtable1のレコードが含まれています)

using (SqliteConnection conn = new SqliteConnection(PhoneUtil.ConnectionString))
{
   conn.Open();
   using (SqliteCommand cmd = conn.CreateCommand())
   {
      cmd.CommandText = "select t1.* from table1 as t1 inner join table2 as t2 on t1.id = t2.id where t1.year=2013";

      // the line below is very slow.
      using (SqliteDataReader reader = cmd.ExecuteReader())
      {
         // Here is fast
         while (reader.Read())
         {
            // ...
         }
      }
    }
}
4

1 に答える 1