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

  • 相关阅读:
    CVE-2019-0708
    windows powershell的常用命令
    sqli-lab(8)
    DVWA--CSP Bypass
    认清自己
    sqli-libs(7)
    DVWA--upload
    sqli-labs(6)
    python学习之路(22)
    BZOJ2434:[NOI2011]阿狸的打字机——题解
  • 原文地址:https://www.cnblogs.com/tobin/p/1539802.html
Copyright © 2011-2022 走看看