diff --git a/frameworks/CSharp/aspnetcore/Benchmarks/Data/DapperDb.cs b/frameworks/CSharp/aspnetcore/Benchmarks/Data/DapperDb.cs index 963268fcba3..8c113148a08 100644 --- a/frameworks/CSharp/aspnetcore/Benchmarks/Data/DapperDb.cs +++ b/frameworks/CSharp/aspnetcore/Benchmarks/Data/DapperDb.cs @@ -37,9 +37,9 @@ public async Task LoadSingleQueryRow() } } - async Task ReadSingleRow(DbConnection db) + Task ReadSingleRow(DbConnection db) { - return await db.QueryFirstOrDefaultAsync( + return db.QueryFirstOrDefaultAsync( "SELECT id, randomnumber FROM world WHERE id = @Id", new { Id = _random.Next(1, 10001) }); } diff --git a/frameworks/CSharp/aspnetcore/Benchmarks/Data/RawDb.cs b/frameworks/CSharp/aspnetcore/Benchmarks/Data/RawDb.cs index 15c399d11c7..51b075baed0 100644 --- a/frameworks/CSharp/aspnetcore/Benchmarks/Data/RawDb.cs +++ b/frameworks/CSharp/aspnetcore/Benchmarks/Data/RawDb.cs @@ -63,10 +63,6 @@ DbCommand CreateReadCommand(DbConnection connection) id.Value = _random.Next(1, 10001); cmd.Parameters.Add(id); - // Prepared statements improve PostgreSQL performance by 10-15% - // Especially if you only call them once, instead of on every execution :) - cmd.Prepare(); - return cmd; } @@ -135,7 +131,6 @@ public async Task LoadMultipleUpdatesRows(int count) } updateCmd.CommandText = updateCommand.ToString(); - updateCmd.Prepare(); await updateCmd.ExecuteNonQueryAsync(); } } @@ -155,9 +150,6 @@ public async Task> LoadFortunesRows() db.ConnectionString = _connectionString; await db.OpenAsync(); - // Prepared statements improve PostgreSQL performance by 10-15% - cmd.Prepare(); - using (var rdr = await cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection)) { while (await rdr.ReadAsync()) diff --git a/frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json b/frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json index 2bc5d511afb..56747edd3ed 100644 --- a/frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json +++ b/frameworks/CSharp/aspnetcore/Benchmarks/appsettings.postgresql.json @@ -1,4 +1,4 @@ { - "ConnectionString": "Server={db_server_placeholder};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;NoResetOnClose=true", + "ConnectionString": "Server={db_server_placeholder};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;NoResetOnClose=true;Max Auto Prepare=3", "Database": "postgresql" }