for ( int i = 0 ; i < 1000 ; i ++ )
{
Npgsql.NpgsqlConnection conn = new NpgsqlConnection(ConnStr);
conn.Open();
conn.Close();
}
DateTime endtime = DateTime.Now;
firstms = endtime.Subtract(begintime).TotalMilliseconds;
DateTime begintime1 = DateTime.Now;
for ( int i = 0 ; i < 1000 ; i ++ )
{
SqlConnection sqlConn = new SqlConnection(sqlConnStr);
sqlConn.Open();
sqlConn.Close();
}
DateTime endtime1 = DateTime.Now;
secondms = endtime1.Subtract(begintime1).TotalMilliseconds;
Response.Write( string .Format( " postgresql:{0},mssql:{1} " ,firstms,secondms));
代码很简单,但测试结果却不能让人满意:
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:15.625
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:0
postgresql:531.25,mssql:0
看来免费的东西还是不好使啊