Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elkOB-0006SH-Vs for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Feb 2018 23:53:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elkOB-0007Mm-0O for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Feb 2018 23:53:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elkOA-0007Mc-KM for pgsql-bugs@lists.postgresql.org; Tue, 13 Feb 2018 23:53:30 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1elkO6-0000r6-Q7 for pgsql-bugs@postgresql.org; Tue, 13 Feb 2018 23:53:29 +0000 Received: by mail-wm0-x241.google.com with SMTP id f3so18947036wmc.1 for ; Tue, 13 Feb 2018 15:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CHqE4EC5naA1F4pdazhIcAa5dIQqWXrgL68SgApm17o=; b=yFefSvk5pXCXFY9ISL5bC4ujXFx/RfpsmCbv56F0518dxv9u/QSG9ytzZC0qT6R/wn wrpLgrbb4MKjPUFblEhRMIzuXbTVmDrHNzjvyXindSgWGcJriWM5BbhOG/cIqDMhNwjg VhRvJg2GQr4Cf5QwqqSrUry1TDqPJcGkGlMzozisZnA6VX917P6LaOdaL0OJAVlrFAqI J6Bd0a7/kZ/BQuO3RfmML9RcCYYbO5cY5tQHyFobzNfozm0IQrIFImj6k5c6L/7lzriF bcJnthioj/TFoLm6PIs9VGKdoxvH4sl71pfLIh3IXmCyzstK/rfe85t0kAHvbG6zRh9u IpmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CHqE4EC5naA1F4pdazhIcAa5dIQqWXrgL68SgApm17o=; b=i6xa4ySraTNpNusgRapDdCvmQqeFqG2DmkSSEk+36+sfYoR71ZOiJWB6KMcSezt9rV IXtc7EGdyO5aIpZmeqIhyQIwzkOsExlQybqIOKJ9HEKnI6k8Qgi3qpVL0yG7wQyTmVBX H78M0z73SwAu/hiKHWXbNmUl+mqFsgiNBNEjIwFCvdlqwYzzSsu7YgM0qc8Gxqfiw9iF eAXz9hHoaMIS/TRIQztCnvLmWerWCVoXvrvk32uWJ9YquLGinjmWQb/HkA1xQ6h6484+ W2oX2hkv2MyWpIPkShiPNKO+DFw8FLwjncs4W4YkPNrk6AUWbxmlRgjIKxEHz9eVIDlm Uo/Q== X-Gm-Message-State: APf1xPAw+0zN6r7c2442SiVcCyyjlBd5B9QgaAaXJvhasaKfPuMew7Z+ sbIt+JtopdigERnBxYiPCOBUcqUymvbWseGSXQ/I14oQ4T/arRadl70ZyBQg8LMbkcQjt/ilKcW S1XloEAll5i73bmT6Qfa4q/PZ0PCFzz4RBPq25FxPEd/4bvOxu5PYTbIWCwepyL1eXUnYhYvltm aFk60u X-Google-Smtp-Source: AH8x226MKoPltDpHMRN8SUw8jvta8wHYyJvyx9z4ErUSIt40n3X0dPvse2x6a28AIkJftYxh7BQITg== X-Received: by 10.80.174.134 with SMTP id e6mr4466872edd.9.1518566004323; Tue, 13 Feb 2018 15:53:24 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id h1sm8640842edb.95.2018.02.13.15.53.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 15:53:23 -0800 (PST) Subject: Re: response time is very long in PG9.5.5 using psql or jdbc To: Andres Freund , David Gould Cc: Tom Lane , =?UTF-8?B?55+z5YuH6JmO?= , pgsql-bugs@postgresql.org References: <72aa8c39225549dd8c1d18f96df8b1e3@pingan.com.cn> <30153.1518488973@sss.pgh.pa.us> <30157.1518548280@sss.pgh.pa.us> <20180213132447.0a26f00c@engels> <20180213213110.5ip4hsnu2hjz52ae@alap3.anarazel.de> From: Tomas Vondra Message-ID: <0bac4aab-8bbf-fefd-b66c-5d87308adabc@2ndquadrant.com> Date: Wed, 14 Feb 2018 00:53:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180213213110.5ip4hsnu2hjz52ae@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 02/13/2018 10:31 PM, Andres Freund wrote: > Hi, > > On 2018-02-13 13:24:47 -0800, David Gould wrote: >> I see this problem fairly frequently. Typically the problem catalog is >> pg_attribute as it has the most rows. However the problem really arises when >> the catalogs become bloated. Once the total size of the catalogs that get >> read at start up approaches the size of shared buffers, and especially if >> several processes start at the same time, it becomes quite noticeable. > > I can obviously see problems with a bloated catalog, but how does that > cause massive slowdowns in *individual* queries as we see here? The > OP's problem isn't the connection establishment performance afaict, but > the first query using specific pieces of catalog data. And that should > be ok-ish performancewise, even if there's bloat. > What if the first connection does not actually go to PostgreSQL, but to some sort of connection pool (like pgbouncer)? That would be consistent with the observed behavior, I think - the first connection would likely have to open connection to a backend, paying all the price. Obviously, this is just a stab in the dark ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services