Connect npgsql to the PostgreSQL database

Source: Internet
Author: User
The country is now catching piracy, but the. NET platform is really expensive, but it is not like giving up. net, you can only change. netframework to mono, change SQL Server to PostgreSQL, just started learning

Comparison of efficiency of connecting npgsql to PostgreSQL with ado.net Code Simple:

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 ));


the code is simple, but the test results are not satisfactory:
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
it seems that free items are not easy to use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.