I have a Desktop Application using MSSQL CE. I am using the CE version because I will need the file transfer in a Mobile Device later.
Using MSSQL CE I could transfer data from CSV File to my SDF Databse in 10-15 seconds with 32000 records.
The problem is when I use the SDF database in my mobile device as it is taking about 24 seconds just for a simple SELECT sku,upc,description,price FROM items WHERE upc='111'
statement.
I would like to try and test SQLite as it is lighter and maybe faster but during the first phase, transfer the data from CSV to the SQLite Databse, it took very long, in 30 mins the data transfer from the CSV is only 1000+ records.
How should I make my queries faster?
My MSSQL code: `FileReader = New StreamReader(StringFileName)
Do While FileReader.Peek() >= 0
TempReaderString = FileReader.ReadLine
TempArraySplitString = TempReaderString.Split("`")
UpdateAppSqlCommand.CommandText = "INSERT INTO Items(Sku, Upc, Description, Price) VALUES('" & TempArraySplitString(0) & "','" & TempArraySplitString(1) & "','" & TempArraySplitString(2) & "','" & TempArraySplitString(3) & "')"
UpdateAppSqlCommand.ExecuteNonQuery()
Loop
FileReader.Close()`
My SQLite Code:
FileReader = New StreamReader(StringFileName)
Do While FileReader.Peek() >= 0
TempReaderString = FileReader.ReadLine
TempArraySplitString = TempReaderString.Split("`")
TempArraySplitString(2) = TempArraySplitString(2).Replace("'", " ")
TempArraySplitString(2) = TempArraySplitString(2).Replace("""", " ")
UpdateAppSqlCommand.CommandText = "INSERT INTO Items(Sku, Upc, Description, Price) VALUES('" & TempArraySplitString(0) & "','" & TempArraySplitString(1) & "','" & TempArraySplitString(2) & "','" & TempArraySplitString(3) & "')"
UpdateAppSqlCommand.ExecuteNonQuery()
Loop
FileReader.Close()
The SQLite took maybe 10x slower moving the data from the CSV to the Database.