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 1elfty-0000WU-8e for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Feb 2018 19:06:02 +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 1elftx-0006he-2R for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Feb 2018 19:06:01 +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 1elftw-0006hU-Pq for pgsql-bugs@lists.postgresql.org; Tue, 13 Feb 2018 19:06:00 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elftu-0002sv-Fx for pgsql-bugs@postgresql.org; Tue, 13 Feb 2018 19:05:59 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D97FF20DB7; Tue, 13 Feb 2018 14:05:57 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Tue, 13 Feb 2018 14:05:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=lbBLSzqIXKDlJiwiejSfSkj6OYEP7 rnKBZo4l5xzi4U=; b=eugtnX2BjxXoQJIvU+uxpqgwWpUhKPHl9KsdTYW7+lYbT J5daghha0vmvWLaIM1osMuo9Hzi2RGKlEGNjvpq2W5xkYVTHL84rISxedngPNOw4 STNKJV+EgdnXCf0YVAbYY3Man/WjkKuFUSm/SdLYhlU0u63qFvNNtfZzuQ13Kihg l/QEYKSDoboPh2Y3kzS3aX0uBpzghrgeVjD1eP0hZF3B4UKXapIyDijafeXNCBZU CAGbXOMy/pHMOXHKfOR+DcprPaIVFjqoTsxJcNzcRgeCKNco9O/4JJpS+6UODt3G cQaWpEoZDPIanKjKxgvjBym3nv3A52aVi133gQo8w== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 82F4D246AC; Tue, 13 Feb 2018 14:05:57 -0500 (EST) Date: Tue, 13 Feb 2018 11:05:56 -0800 From: Andres Freund To: Tom Lane Cc: =?utf-8?B?55+z5YuH6JmO?= , pgsql-bugs@postgresql.org Subject: Re: =?utf-8?B?562U5aSN?= =?utf-8?Q?=3A?= response time is very long in PG9.5.5 using psql or jdbc Message-ID: <20180213190556.u62ypanleiw2oufw@alap3.anarazel.de> References: <72aa8c39225549dd8c1d18f96df8b1e3@pingan.com.cn> <30153.1518488973@sss.pgh.pa.us> <30157.1518548280@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30157.1518548280@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-02-13 13:58:00 -0500, Tom Lane wrote: > =?gb2312?B?yq/Twrui?= writes: > > Yes,we have more than 500 thousand of objects,and the total size of the database is almost 10TB.Just as you said,we may need to reduce the objects number,or you have any better solution? Might also be worth knowing where the time is spent. Any chance you could use a profiler like perf to figure out exactly where the time is going? A simple thing wich might already give some hints is to show us parser & planner stats: SET log_parser_stats = true; SET log_planner_stats = true; SET client_min_messages = log; \i t.sql that should print things like LOG: 00000: PARSER STATISTICS DETAIL: ! system usage stats: ! 0.000043 s user, 0.000001 s system, 0.000041 s elapsed ! [3.086537 s user, 0.061010 s system total] ! 100592 kB max resident size ! 0/0 [183368/0] filesystem blocks in/out ! 0/0 [651/3696] page faults/reclaims, 0 [0] swaps ! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent ! 0/0 [818/10] voluntary/involuntary context switches LOCATION: ShowUsage, postgres.c:4545 Just out of paranoia, could you share the result of: SHOW ignore_system_indexes; > Hmph. I tried creating 500000 tables in a test database, and couldn't > detect any obvious performance problem in session startup. Did you try 9.5 or master? We've had a few improvements... But I think the majority are only going to matter when a lot of relations are touched in the same relation... Greetings, Andres Freund