• npgsql连接postgresql数据库


    国家现在开始抓盗版了,无奈,.net平台实在是比较贵的,但又不像放弃.net,只能把.netframework换成mono,把sql server换成postgresql,刚刚着手学习
    今天测试用
    npgsql 连postgresql的效率
    对比
    ado.net连sql server
    代码很简单:
    double firstms = 0.0,secondms=0.0;
     
    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
    看来免费的东西还是不好使啊


                                                       第八宗罪Tobin

  • 相关阅读:
    你的代码真的很健壮吗
    GAE 博客——B3log Solo 0.1.1 发布预告
    GAE 博客——B3log Solo 0.1.1 发布了!
    GAE 博客——B3log Solo 0.1.1 发布了!
    使用logcxx库和boost库构建系统日志的格式化输出
    Simple Hierarchical clustering in Python 2.7 using SciPy
    将python3.1+pyqt4打包成exe
    Installation — SIP 4.14.2 Reference Guide
    PyQt 维基百科,自由的百科全书
    沙湖王 py行者
  • 原文地址:https://www.cnblogs.com/tobin/p/1539802.html
Copyright © 2020-2023  润新知