Improve Performance - Bulk, Batch Updates
Posted: Sun  08 Mar 2015 16:42
				
				Hello!
I'm using dotConnect for SQLite version 5.2.283, EntityFramework (Model First) for the data access. I am trying to improve the performance of my bulk inserts (Batch Updates) but I can't seem to see any improvements based on my changes to the configuration of the provider or the data model.
Currently I'm seeing about 1000 inserts every 10 seconds. I would appreciate any help fine tuning things or shedding some light on the limitations of SQLite.
Here is a simplified example of how I'm doing my inserts:
I tried turning on Batch Updates as per the documentation:
http://www.devart.com/dotconnect/sqlite/docs/
However, I noticed this statement about "Batch Updates Limitations" from the doc above:
"Statements with the RETURNING clause, for example, statements that update or insert entities with columns having the StoreGeneratedPattern attribute value set to Identity or Computed."
Currently the entities I am inserting do have a Int64 as the entity (primary) key and are configured to use "Identity" store generation.
I did try changing the Store Generated column to "None" but did not see any improvements.
Am I missing something?
Also I came across this in the forums: http://forums.devart.com/viewtopic.php? ... ulk#p95190
I realize that that forum is for Oracle; however it mentions an investigation to see if Batch Updates can be used with StoreGeneratedPattern of "Identity". Is this possible for SQLite?
Is there something else I should be configuring or configuring differently to improve performance?
Please let me know if you need any more information.
Thank you for your time!
			I'm using dotConnect for SQLite version 5.2.283, EntityFramework (Model First) for the data access. I am trying to improve the performance of my bulk inserts (Batch Updates) but I can't seem to see any improvements based on my changes to the configuration of the provider or the data model.
Currently I'm seeing about 1000 inserts every 10 seconds. I would appreciate any help fine tuning things or shedding some light on the limitations of SQLite.
Here is a simplified example of how I'm doing my inserts:
Code: Select all
private void InsertDataSamples(RequestCreateDataSamples request)
{
  DataCollection dataCollection = this.DataContext.DataCollections.Single(
    dc => (dc.Id == request.DataCollectionId));
    
  foreach (DataSample sample in request.DataSamples)
  {
    dataCollection.DataSamples.Add(dataSample);
  }
  
  // Save the data samples.
  this.DataContext.SaveChanges();
  // Also tried with: SaveOptions.None
}http://www.devart.com/dotconnect/sqlite/docs/
Code: Select all
SQLiteEntityProviderConfig config = SQLiteEntityProviderConfig.Instance;  
config.DmlOptions.BatchUpdates.Enabled = true;"Statements with the RETURNING clause, for example, statements that update or insert entities with columns having the StoreGeneratedPattern attribute value set to Identity or Computed."
Currently the entities I am inserting do have a Int64 as the entity (primary) key and are configured to use "Identity" store generation.
I did try changing the Store Generated column to "None" but did not see any improvements.
Am I missing something?
Also I came across this in the forums: http://forums.devart.com/viewtopic.php? ... ulk#p95190
I realize that that forum is for Oracle; however it mentions an investigation to see if Batch Updates can be used with StoreGeneratedPattern of "Identity". Is this possible for SQLite?
Is there something else I should be configuring or configuring differently to improve performance?
Please let me know if you need any more information.
Thank you for your time!