zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    window 7/8/10 安装nginx
    全面了解 Nginx 到底能做什么
    MySQL优化
    office 2013 破解工具 及 软件下载
    centos6+如何对外开放80,3306端口号或者其他端口号
    CentOS 中查看软件的版本号
    CentOS 中安装 mysql 5.7+
    STL入门大全(待编辑)
    Feign
    微信公众号
  • 原文地址:https://www.cnblogs.com/tobin/p/1539802.html
Copyright © 2011-2022 走看看