Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngv1V-00087n-Oh for pgsql-performance@arkaria.postgresql.org; Tue, 19 Apr 2022 21:04:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngv1U-0003cj-KE for pgsql-performance@arkaria.postgresql.org; Tue, 19 Apr 2022 21:04:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngv1U-0003ca-68 for pgsql-performance@lists.postgresql.org; Tue, 19 Apr 2022 21:04:32 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ngv1N-00028p-6A for pgsql-performance@lists.postgresql.org; Tue, 19 Apr 2022 21:04:31 +0000 Received: by mail-io1-xd2d.google.com with SMTP id 125so18986236iov.10 for ; Tue, 19 Apr 2022 14:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=AEhqHKDwQ8+kewIiM/hlhOEkKjGk2feCl692EFlt7MQ=; b=Tu7vSHcZ9tjduqn5WcPpAOKy6uliLprlj7jiMb9AMuI46ZdBljRxfEwCSkt5YUR7sV 1vFvjC7zXqGvFdEWnhRZPMhVvCHTPnVA9OCrqZiEJAX7P4z2CHM1vYnMP3qnbIOm+UUN HULyGdHxXS2RVcAzGc0A1QNNgKZMFSmAP2N6ZCsceaJG8G3kM5ejDjpm6bOu1XuwVBbL pfqlKYBxWni6iQBF3BDrQxPU90ruDBpIeIgzwzA0qcVkaAmIUEjaO3hgi4swCBlnaM/A tZ8BUGHZbqu3WP085wrN0+VzbDgHzHRaMN0T6krXww7E2Lqs1xPo153uoRYRralizoVU Ie0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=AEhqHKDwQ8+kewIiM/hlhOEkKjGk2feCl692EFlt7MQ=; b=2syCs2NQwGt6kprNBFql3/PtnU+QpsfBLS9KtvJPhvRgVSJYN0bU5FIXMRrtSg0VFL lxc76y8JJeapdpVxVPD+g/kWolMiTaoDVGy0wzFoF8x4x5BYxxT4qUOByB6RXqmheTlc Ib8IyqHUqvEPwSo1G+/BvRgTF+AtmsXVLv9ksB3bBByRgehqzXlTrtS+T6/RFvotoJ8Q 1KUKO+7oRl4ZzkOCR8mU62EelznYFaxASG28IlfXFFK2S9zjSQgi2wn36mwJNPyHR1ML SG9uRrey/83ULhl9jxJVowWAY4qH5MnZBp3iFuncCPjusuzAHG+bNh55OoPyUgnsmWyJ zx7A== X-Gm-Message-State: AOAM532SZyMV6bTPi+LzzQgPEwHEp/bUcb40K/geSDs8ZslbIG2i1B0/ MbyLmB0lLTiQzZ8JQXx3UTwpy4aYG7FqqQ== X-Google-Smtp-Source: ABdhPJxwMhfJNl8g/OLCvJZ7FuT2W8B6zdnEtJvS1ZWC+B400ECgaBsXdQlsY7xykfdyOqYrg9np/A== X-Received: by 2002:a02:920c:0:b0:324:2206:5c3c with SMTP id x12-20020a02920c000000b0032422065c3cmr8974365jag.240.1650402263088; Tue, 19 Apr 2022 14:04:23 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k6-20020a6b4006000000b00649d7111ebasm10164938ioa.0.2022.04.19.14.04.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Apr 2022 14:04:22 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id F3511800F3C; Tue, 19 Apr 2022 16:04:21 -0500 (CDT) Date: Tue, 19 Apr 2022 16:04:21 -0500 From: Justin Pryzby To: Sbob Cc: pgsql-performance@lists.postgresql.org Subject: Re: significant jump in sql statement timing for on server vs a remote connection Message-ID: <20220419210421.GL26620@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 19, 2022 at 03:00:09PM -0600, Sbob wrote: > We are debugging a sql performance issue. We have a sql file with 50,000 > simple select statements in it. If I run the file locally it completes in > less than 15sec.  If I force the local connection to be a tcp/ip connection > via psql -h and I get approximately the same results, 15 - 16sec. > > > However if we move the file to another server in the same network and run > with a psql -h then it runs for more than 10min. Are there any postgres > specific issues / settings / connection overhead  we should look at? Or is > this simply a network issue and fully outside the scope of the postgres > database? What OS ? What kind of authentication are you using ? Is there a connection pooler involved ? Did you try like that ? Did you test how long it takes to run 10k empty statements locally vs remotely ? time yes 'SELECT;' |head -9999 |psql ... >/dev/null -- Justin