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 1hgIDd-0007SK-FH for pgsql-performance@arkaria.postgresql.org; Thu, 27 Jun 2019 00:24:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hgIDb-0006L1-DA for pgsql-performance@arkaria.postgresql.org; Thu, 27 Jun 2019 00:24:51 +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 1hgIDa-0006Ku-VO for pgsql-performance@lists.postgresql.org; Thu, 27 Jun 2019 00:24:51 +0000 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hgIDX-0005Hg-BU for pgsql-performance@lists.postgresql.org; Thu, 27 Jun 2019 00:24:50 +0000 Received: by mail-io1-xd42.google.com with SMTP id u19so782942ior.9 for ; Wed, 26 Jun 2019 17:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GcLSpUJZNeQhZt0Aco4KPMSjMlC8tnf6RYMbzpomyrE=; b=sxWUxCLShDTNZbsKGFoBswEWtWLM6aY1BDgiMqvpD8jy6S89mEOU9e06fba6xmdiW8 1qB7r9HhviZOZRfOP3l15MiRvhlBbCPO5qZ2dqfbReaBS1W9hKCeGFj3aNLsFOZTqFqA 50w0hVWYBEV3/uo+4n4bIlAJhK8z5r1bA7dvEIId84qF9FitYqX7hHkbi4bdYITPJj4t nMrn8Qhn8x0GXcyiduwt2Lf7T/uBFAav7Qr4/sg/0IhN3jUuxse+TKIpw8dQUKO+kDPM 4kp2pFbnFCFLcuRaNEfEvNe6NJduPlcIHAOgLgqXY2Xn/hQ5ejc612D0ZTa27ChDnkXV sAYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GcLSpUJZNeQhZt0Aco4KPMSjMlC8tnf6RYMbzpomyrE=; b=F9ozz49awcE2VO89+13ZqIQV6s+CnDlrie2nL2jXmmE8pHMh+vjwkS1OlPwxa/W3Gt KY7zN1VvZz0IzoNPB1ygHRmhWVcUvqpbn+uRSipVypy3/rKzziohfxtJh4L+5j5kLMt6 r0i3M4AoFjEqXE0C0LErSQjyQ08F5yq2FykpK6VEFXOuMgqCe66NBiorwNAAOPZuBgyJ P5nDjik3C/uprgeREfzOSgk8PpEPJEy0QmCDiddI+qD6/zWsjdOE7eIuLOpX9tVTdi9O HCtjqnjZ54ohlXuWyLsoCI8lfW/jkziK+mgisOIoHAOwKW3hYNlH50bRHWWvDIsNW/5F uE4A== X-Gm-Message-State: APjAAAWQoXas5SCafzHsr42y2HtOqSEpqmt4Ytcg9rwtqtFsr094JH1g 1bwhTWjWky8Vqy4UA1zzozzCmm6BFiE= X-Google-Smtp-Source: APXvYqwoOmxOpp4qQlNl9z4VOf4P7D2ExvgWQ6gfGp0em+vsxuSfml1lgYCz7wZFdgKYK+MNQDrlJA== X-Received: by 2002:a6b:6001:: with SMTP id r1mr1221976iog.229.1561595084693; Wed, 26 Jun 2019 17:24:44 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v26sm364590iom.88.2019.06.26.17.24.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 17:24:44 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id C93F9800C83; Wed, 26 Jun 2019 19:24:42 -0500 (CDT) Date: Wed, 26 Jun 2019 19:24:42 -0500 From: Justin Pryzby To: Hugh Ranalli Cc: pgsql-performance@lists.postgresql.org Subject: Re: Perplexing, regular decline in performance Message-ID: <20190627002442.GQ18602@telsasoft.com> References: <20190625162338.GF18602@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jun 26, 2019 at 03:00:43PM -0400, Hugh Ranalli wrote: > Pausing the admin queries isn't an option in our environment, especially as > the issue reveals itself over the course of days, not minutes or hours. Perhaps you can pause it for a short while at EOW and see if there's a dramatic improvement ? > ?column? | count | count | datname | coalesce | toast | dirtyfrac | avg > ------------------------+---------+-------+-----------+-------------------------+----------------+----------------------------+-------------------- > 0.24904101286779650995 | 1044545 | 0 | mydb | position | | 0.000000000000000000000000 | 4.8035517857057379 > 0.16701241622795295199 | 700495 | 0 | mydb | stat_position_click | | 0.000000000000000000000000 | 1.9870234619804567 > 0.09935032779251879171 | 416702 | 6964 | mydb | pg_toast_19788 | harvested_job | 0.01671218280689797505 | 1.9346079452462431 > 0.06979762146872315533 | 292750 | 0 | mydb | url | | 0.000000000000000000000000 | 4.9627873612297182 > 0.03795774662998486745 | 159205 | 0 | mydb | stat_sponsored_position | | 0.000000000000000000000000 | 1.8412361420809648 > 0.02923155381784048663 | 122605 | 0 | mydb | pg_toast_20174 | page | 0.000000000000000000000000 | 3.0259532645487541 > 0.02755283459406156353 | 115564 | 0 | mydb | location | | 0.000000000000000000000000 | 4.9953532241874632 > 0.02015273698468076320 | 84526 | 1122 | mydb | harvested_job | | 0.01327402219435439983 | 4.9922154130090150 > 0.01913348905375406298 | 80251 | 0 | mydb | pg_toast_20257 | position_index | 0.000000000000000000000000 | 4.9880001495308470 > > harvested_job is the rapidly growing "problematic" table I am talking > about. page is the 355 GB table that gets referenced on the public > searches. I'll google, but is there a place I should look to understand > what I am seeing here? I should label the columns: |buffer_fraction | nbuffers| ndirty| datname | relname | toast | dirtyfrac | avgusage It looks like possibly harvested job is being index scanned, and its toast table is using up many buffers. At the EOW, maybe that number is at the expense of more important data. You could check pg_stat_user_tables/indexes for stats on that. Possibly you could make use of index-only scans using covering indexes (pg11 supports INCLUDE). Or maybe it's just too big (maybe it should be partitioned or maybe index should be repacked?) > Also, Should pg_buffercache perhaps be run at the beginning and end of the > week, to see if there is a significant difference? Yes; buffercache can be pretty volatile, so I'd save it numerous times each at beginning and end of week. > > Could you send query plan for the slow (customer-facing) queries? > > > > https://wiki.postgresql.org/wiki/Slow_Query_Questions#EXPLAIN_.28ANALYZE.2C_BUFFERS.29.2C_not_just_EXPLAIN > > I can, but can I ask why this would matter? My very tentative guess is that harvested_job itself isn't the issue, but some other, 3rd thing is the issue, which also increases (at least roughly) with time, same as that table. It'd help to see the buffer cache hit rate for that query (and its different query plan nodes), at beginning and EOW. Justin