mardi 2 juin 2015

What is the fastest way to retrieve a million records from an SQLite database file and display it in the WPF Datagrid?

I have an SQLite3 Database file, MyDatabase.sqlite having a million rows and 50 columns (File size ~200MB). I want to load the data from this file and display it on a WPF Datagrid.

    DataTable dt = new DataTable();
    using (SQLiteCommand cmd = new SQLiteCommand("Select * from Orders", conn))
    {
        using (IDataReader rdr = cmd.ExecuteReader())
        {
            dt.Load(rdr);
        }
    }

It takes around 54 seconds to execute. SQLiteAdapter.Fill(dataset) also takes the same amount of time. Is there a faster way to fetch data from SQLite DB ?

Aucun commentaire:

Enregistrer un commentaire