Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1040641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:14:58+00:00 2026-05-16T15:14:58+00:00

why connect to postgres over internet or VPN slower than sql server ? I

  • 0

why connect to postgres over internet or VPN slower than sql server ?
I have test

    DateTime now0 =  System.DateTime.Now;
    string sqlconnectsrting = "server=xxx.xxx.xxx.xxx;database=pubs;uid=sa;pwd=";
    for (int i = 0; i < 1000; i++)
    {
        SqlConnection connect = new SqlConnection(sqlconnectsrting);
        connect.Open();
        connect.Close();
    }
    System.DateTime now1 = System.DateTime.Now;
    Console.WriteLine(String.Format("SQL Connect time : {0}", now1 - now0));

    now0 = System.DateTime.Now;
    string npgconnectsrting = "Server=xxx.xxx.xxx.xxx;Port=5433;User Id=postgres;Password=postgres;Database=hr_data;";
    for (int i = 0; i < 1000; i++)
    {
        NpgsqlConnection connect = new NpgsqlConnection(npgconnectsrting);
        connect.Open();
        connect.Close();
    }
    now1 = System.DateTime.Now;
    Console.WriteLine(String.Format("Postgres Connect time : {0}", now1 - now0));

When connect is localhost they are similar, but when connect is over internet. SQL connect take 1-5s but postgres take 3-7 minutes.
Is there anyway to fix this?

Tuan Hoang Anh

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:14:58+00:00Added an answer on May 16, 2026 at 3:14 pm

    What’s the setting for SSL?

    SHOW ssl;
    

    Creating an SSL-connection will be slower, even when you actualy don’t use SSL. Turn it off if you don’t need the extra security.

    3 to 7 minutes is about 180 to 420 seconds, if you create 1000 connections, it will “only” take 0.18 to 0.42 seconds for each connection. SQL Server is not going to make a 1000 connections within 1 to 5 seconds over a network, the network will be too slow. Sounds like a connection pool that let you believe you have created a new connection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can connect manually by doing: M-x sql-postgres and type the User, Database, Host,
I have installed Postgres in my machine, and I'm trying to connect to it
I connect to SQL Server database and grab a DataSet of the result with
I have to connect to a legacy postgres database which has ENCODING = 'SQL_ASCII';
We have a postgres database which a lot of scripts connect to. Crucially, there
I need to connect my backend in Postgres with GWT, but I am not
I connect to our Ubuntu production server using PuTTy. I want to reindex a
To connect my server with the APN server I use the following code. //
Upgraded 10.6 from 10.5 and now postgres 8.1 is whacked. To make things worse
I am trying to connect my Postgres database in MATLAB and it is throwing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.