Tuesday, March 8, 2016

Is Entity Framework the best performing option for PostgreSQL and .NET applications?

Updated on Monday, April 15, 2017
Object-relational mapping (ORM) solutions provide a virtual layer between actual application code and backend database (DB) being used in an application via create, read, update and delete (CRUD) operations. PostgreSQL has been one of the top notch backend DB being deployed with Microsoft .NET applications worldwide. This experiment will be targeting various ORM solutions which may perform well with Microsoft .NET platform and PostgreSQL as backend. The list of ORM solutions that will be evaluated includes NHibernate (NH), OrmLite, MicroLite, Entity Framework (EF), LINQ to PostgreSQL, I-Nercya EntityLite Core, Symbiotic Micro ORM x64, LLBLGen Pro, Uni.ORM, and FluentData. It’s very much true that one may be easy to setup and consume than the other, but scope of this experiment will be limited to analyzing these ORM solutions based on how fast they are able to perform CRUD operations with PostgreSQL and .NET.
-1. know your test system
0. Create test databases
1. EntityFramework6.exe
2. FluentData3.exe
3. InercyaEntityLite1121.exe
4. LINQtoPostgreSQL17x.exe
5. LLBLGenProLite51Console.exe
6. MicroLite6.exe
7. NHibernate4.exe
8. OrmLite.exe
9. SymbioticDataProviderPostgreSql2.exe
10. UniORM144.exe

git clone https://bitbucket.org/hemantup/orm.git -b master

test Run output: (Average calculated from 10 Cycles)

As pdf:



  1. one more contender - http://vita.codeplex.com. Supports Postgres, full LINQ, and will certainly beat EF and NH in performance - especially update/insert - it has batch mode, executing all changes in one roundtrip

  2. Hi, you mentioned that "PostgreSQL has been one of the top notch backend DB being deployed with Microsoft .NET applications worldwide." Do you have any examples of companies or projects using this tech stack?

    1. Please refer to no of downloads on NuGet for related stuff. e.g, as of 11/6/15 , no of downloads for nuget packages realte to this combination:

      ORM Downloads
      1 NHibernate 1,022,019
      2 OrmLite.PostgreSQL - Fast, code-first, config-free Poco ORM 4.0.46 24793
      3 DotConnect Express for PostgreSQL 7.4.521 16169
      4 MicroLite 6.2.6 7058
      5 Npgsql for Entity Framework 6 3.0.3 4,155
      6 LINQ to PostgreSQL, 3615
      7 i-nercya EntityLite Core 1.12.1 2,206
      8 Symbiotic Micro ORM x64 4.0.3 1,783
      9 LLBLGen Pro Dynamic SQL Query Engine for PostgreSql 4.2.20151023 682
      10 Uni.ORM 1.3.7 627
      11 Dapper.Rainbow.PostgreSql 0.7.1 510
      12 Tiraggo Architecture for PostgreSQL 2014.1.419.3 447
      13 Prius ORM for people who like stored procedures 1.0.6 342
      14 FluentDAO 3.1.0 183

      Neverthless, purpose of this article is not to convince you: go and use PostGreSQL with .Net,but one step further : if you choose this combination then what ORM to choose of the two most popular.


  3. Hello, I'm the creator of EntityLite. I'm been looking at the benchmark code and I have seen it is not fair. Create, update and delete benchmarks use transactions on all orm's but EntityLite. You should start a transaction by calling ds.BeginTransaction before starting the loop that creates, updates or delete rows, and call ds.Commit after the loop