I need to get some data based on a keyword, the request is verified to be 100% accurate, but the problem is that the reader loading is rather slow. I tried replacing this request with one that does not contain inner join , and the download was pretty fast. Therefore, I am surprised since I select only one column, why does DataTable.Load () take so long? Is SQLite ExecuteReader loading all results, not just a single column?
Prior to using the DataTable, the average runtime of each reader.Read() was 7 seconds.
This is my code:
_database.Connect(); var selectCommand = new SQLiteCommand( @"SELECT A.ID AS MY_ID FROM MD INNER JOIN TMD ON MD.ID = TMD.ID_MD INNER JOIN TR ON TR.ID = TMD.ID_TR INNER JOIN P ON P.ID = TR.ID_P INNER JOIN DP ON DP.ID_P = P.ID INNER JOIN CD ON CD.ID = DP.ID_CD WHERE CD.DESC = @desc" ); selectCommand.Parameters.AddWithValue("@desc", value); using (DbDataReader reader = _database.ExecuteQuery(selectCommand)) { DataTable data = new DataTable("MyData"); data.Load(reader); } _database.Disconnect();
performance c # sqlite datatable loading
iCantSeeSharp
source share