Skip to content

Purpose of this project is to show different approaches for inserting huge number of rows into Sqlite database using ADO.NET provider.

Notifications You must be signed in to change notification settings

IMujagic/adonet-sqlite-insert-benchmarking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ADO.NET Sqlite Insert Benchmarking

Purpose of this project is to show different approaches for inserting a huge number of rows into Sqlite database using ADO.NET provider.

Default approach where each insert is packed in its own transaction has a bad performance and that was the motivation to explore different approaches and measure which one has the best performance. Every approach has its own repository class and can be tested individually.

  1. Default approach where each insert is commited separately is implemented in repository RepositoryWithoutTransaction class
  2. Second approach is to wrap all inserts inside one transaction => RepositoryWithTransaction class
  3. Second approach can be slightly improved by reusing the same SqliteCommand object for every insert => RepositoryWithTransactionReusedCommand class

Test was executed for different sample sizes (1, 10, 100, 1k, 10k and 100k) on Dell XPS 9370 with i7 8th Gen processor, 8 GB RAM and SSD Disk.

Results:

alt text

Conclusion

Clear winner, in total, is the 3rd approach where all inserts are wrapped inside one transaction and they all reuse the same SqliteCommand. Only when we are inserting 1 item, in that case the default approach is slightly faster than the other two.

About

Purpose of this project is to show different approaches for inserting huge number of rows into Sqlite database using ADO.NET provider.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages