Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glGer-0006An-Vg for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Jan 2019 17:13:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glGep-0007H9-KE for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Jan 2019 17:13:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glGep-0007H2-DJ for pgsql-hackers@lists.postgresql.org; Sun, 20 Jan 2019 17:13:15 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glGei-0001Od-L0 for pgsql-hackers@postgresql.org; Sun, 20 Jan 2019 17:13:15 +0000 Received: by mail-wm1-x342.google.com with SMTP id r24so4507033wmh.0 for ; Sun, 20 Jan 2019 09:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=luND0l8Y4dpnm6WIVyk/W5bD2vKHERlqORIH32ZklPo=; b=DCO2b0veVK+U8ccQ5GEjm9IZ8GL+LI+FVHsJpg6G7yYpBBs9sbsdGsMA8bPOKYBG28 7WhqrwJPyzwKTcepNoKq7VwNB1rNOa4dUjsODSwu/qJp9x12KzPOAVOCxYgVUbyTo6kv r5HihsD7GP6TqFwDh9QnmAL7XfoMiC9+JgMvIikAVvZkxtB/KeBhaIW/CIShmOjaVfux Lz/qQCybqNEej2Ac34qVo8+ytgQXIn+Y3YwiYiEGlQy/OiHh3q/LtsqOIsFEe6AMXvyd pMrv5pwIHW6IeFX04yhkdh2IB7X33HwGA1a8sf61BjEPy+QsrUOtlbxUE6tC8puAdw08 hpzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=luND0l8Y4dpnm6WIVyk/W5bD2vKHERlqORIH32ZklPo=; b=MIaEwcSCEcr7FVjmkQVuU1KhfhjV25fx6/bq/RBR+Vgng+kZJ7CaRLcbyGMjqHaLte Af+7c9rw/MwjEC++trCmfphN0RVb2zRSPuz5in8L1/h2O05/y8EkobQ8fLeNNz6OgA7R 8M8Fn/+ba4O1vmBYKkhNj2HY1EubyR+VXoTAXDSbo2oQknZZZwmnyoFzBUKLXR1tCit1 l1F4+dg9Qj+oZO+PhxRKc9KpYlGzLQoUAs9cqkXi7LRXrMdVquCpWQWm3iYnV7IRMtkF ervytP5vF1vMhoCy2Kv+VOhW2/bibgLmIREIXYfGHh5cMviK1a4ipCenMY+jKIWoA6Qi BcJQ== X-Gm-Message-State: AJcUukfzhDY1Y2MrSNY8BNzC+LgaWC/6QhnyA7ApJ2uO9oEwpjqakRSl Ws4szjBDKSuPsK4cckUjGVfGZTsV/ZqynJIZO2Hb1DqUhPXHh+zGNqf/oFPloBIlSkT+b8B6uzh F1fzfGrjvs/Qrx22dlfVzczDpKK1jGHbH5L0qvhSpSsHXH7p7bkyxOHNdjVBRmTp0bY98RfjVWI 7S+RD97K1lSe8= X-Google-Smtp-Source: ALg8bN5DLOeE1xURni4koYZofdCNsJuEtHsUkWHI3PYzzlQ9pLd90OVJsxdXS7HWhF+EUT/CK40ktg== X-Received: by 2002:a1c:9d57:: with SMTP id g84mr22423578wme.16.1548004386674; Sun, 20 Jan 2019 09:13:06 -0800 (PST) Received: from [10.137.2.19] (ip-86-49-251-50.net.upcbroadband.cz. [86.49.251.50]) by smtp.gmail.com with ESMTPSA id x10sm114612036wrn.29.2019.01.20.09.13.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jan 2019 09:13:05 -0800 (PST) Subject: Re: shared-memory based stats collector From: Tomas Vondra To: Kyotaro HORIGUCHI Cc: alvherre@2ndquadrant.com, andres@anarazel.de, ah@cybertec.at, magnus@hagander.net, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org References: <20181112.201042.147595779.horiguchi.kyotaro@lab.ntt.co.jp> <8e041a34a70ae5d44cb10a7e516308e2f6d1b651.camel@2ndquadrant.com> <6c079a69-feba-e47c-7b85-8a9ff31adef3@2ndquadrant.com> <20181127.175949.06807946.horiguchi.kyotaro@lab.ntt.co.jp> <06f751c9-e400-3742-83f1-3f2292297622@2ndquadrant.com> Message-ID: Date: Sun, 20 Jan 2019 18:13:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <06f751c9-e400-3742-83f1-3f2292297622@2ndquadrant.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, The patch needs rebasing, as it got broken by 285d8e1205, and there's some other minor bitrot. On 11/27/18 4:40 PM, Tomas Vondra wrote: > On 11/27/18 9:59 AM, Kyotaro HORIGUCHI wrote: >>> >>> ...>> >>> For the main workload there's pretty much no difference, but for >>> selects from the stats catalogs there's ~20% drop in throughput. >>> In absolute numbers this means drop from ~670tps to ~550tps. I >>> haven't investigated this, but I suppose this is due to dshash >>> seqscan being more expensive than reading the data from file. >> >> Thanks for finding that. The three seqscan loops in >> pgstat_vacuum_stat cannot take such a long time, I think. I'll >> investigate it. >> > > OK. I'm not sure this is related to pgstat_vacuum_stat - the > slowdown happens while querying the catalogs, so why would that > trigger vacuum of the stats? I may be missing something, of course. > > FWIW, the "query statistics" test simply does this: > >   SELECT * FROM pg_stat_all_tables; >   SELECT * FROM pg_stat_all_indexes; >   SELECT * FROM pg_stat_user_indexes; >   SELECT * FROM pg_stat_user_tables; >   SELECT * FROM pg_stat_sys_tables; >   SELECT * FROM pg_stat_sys_indexes; > > and the slowdown happened even it was running on it's own (nothing > else running on the instance). Which mostly rules out concurrency > issues with the hash table locking etc. > Did you have time to investigate the slowdown? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services