I have a table PartNumbers
with 10 columns with mixed data types and just over 100,000 rows.
Here is my test:
I've put an index on the ID column:
CREATE UNIQUE INDEX IndexName ON [PartNumbers] (ID)
I get a list of 1000 randomly selected ID's (Random_ID_List
) and loop through each ID to fetch the description from the table:
Dim Stop_Watch As New Stopwatch
Stop_Watch.Start()
Dim Results As New List(Of String)
LocalDB.SQLCe_Connection.Open()
For Each ID As Integer In Random_ID_List
Dim sqlcmd = LocalDB.SQLCe_Connection.CreateCommand()
sqlcmd.CommandText = "SELECT Description FROM PartNumbers WHERE ID = " & ID
Results.Add(sqlcmd.ExecuteScalar)
Next
LocalDB.SQLCe_Connection.Close()
Stop_Watch.Stop()
Dim Result_Time As Long = Stop_Watch.ElapsedMilliseconds
My result is:
- Result_Time = 36283 ms (36 seconds)
Is this normal?