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 1kJzhm-0006eQ-2I for pgsql-admin@arkaria.postgresql.org; Sun, 20 Sep 2020 13:48:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kJzhl-0007ji-1F for pgsql-admin@arkaria.postgresql.org; Sun, 20 Sep 2020 13:48:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJzhk-0007jX-NX for pgsql-admin@lists.postgresql.org; Sun, 20 Sep 2020 13:48:36 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kJzhi-0004wp-Cd for pgsql-admin@lists.postgresql.org; Sun, 20 Sep 2020 13:48:35 +0000 Received: by mail-pl1-x630.google.com with SMTP id m15so5520778pls.8 for ; Sun, 20 Sep 2020 06:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZnF7EsmhLhfq8CLEwYkBbGq4BOGatmrFO13sqzqPmtY=; b=hdmsYVz1Uz6F/pv9s5pASG49lCzFl9UIC3JWcFHY5/emP/VOPto9Qghko41WoShnTp UCOHhlWabtjGxe/YbWYXlRexMz+6Xx4yKslj9tc2Sqdem8QKampEdHTTvhJQEt1y8tRS Zg+h8T1/6i9286HNNNvMdMfaIXFRjSbLYMD3JIOtKNUGxC1Wx/xp7pBlv0Sab98taZNs KLyni1IUAA296UsuiXrbfkcNAahKCi6wKq+Q4uycLjDW94gNXyYY6W1QMOQd8Xw62K/J +w0n0PUIocbLA88uLT37lyc3ZWGVuc1ypOMbFBsQhMNZoQ6XcWxR2hehhCvYWYiFNiHy +flg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZnF7EsmhLhfq8CLEwYkBbGq4BOGatmrFO13sqzqPmtY=; b=eXj9G6gZ8y7GduEiPm3UXr6UHanC2+09cffHnKamI8Lk/qrg8jpzVw75PiOQcZ3hE2 FrOUkyZnj1vCrApdxS4+StfYr33t6A3wLlEigNnc/3Q+2xT21ssckfDNeO5GgH3d/IuP aa3KMiy/gGAUxzAElT/tgIxZHbB93gH09xoLBxOWKvJp++mpRPcxLjlT4DbrkDQI0XR0 2VMEpXUv6wK0d0GSU6MizFa8N7ccpTI7t6z2a4aXdKL2vWbZI3Ee6I6KDxzNoqkbvsCe o/WB9d8OOYOz+LH5ggwd3NgkfFnkMBer4+NEIaTfJKs5PmJ9Qmhh62JfxLpjjzqqHHrn ebtA== X-Gm-Message-State: AOAM531kboHkFQH9R/7d9quvrKz9IhVBFBhvB8uq0yB/mEwKH20oc9hQ vEdLJxAii7vjBHOpZkVR5MSl5JEFD4zidaZlsnA= X-Google-Smtp-Source: ABdhPJyBmQGlIPbJqSASQmb8b39RabsOA1s8/hdy3O8LPjLMd0BDB8osfHTA/k4JZmY0UGrbn68cBuz4GctxYGURbKI= X-Received: by 2002:a17:902:6902:b029:d0:cb2d:f26d with SMTP id j2-20020a1709026902b02900d0cb2df26dmr40889033plk.6.1600609713252; Sun, 20 Sep 2020 06:48:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shrikant Bhende Date: Sun, 20 Sep 2020 19:18:22 +0530 Message-ID: Subject: Re: Query taking seq scan on a table To: Avinash Kumar , dbatocloud17@gmail.com Cc: pgsql-admin@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000061f24905afbefd9c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000061f24905afbefd9c Content-Type: text/plain; charset="UTF-8" Hello, show seq_page_cost; 1 show random_page_cost; 4 storage type : SSD Table size : 39 GB There are no columns added, also I haven't found anything where we need to update the data for older rows. Thanks On Sun, Sep 20, 2020 at 6:55 PM Avinash Kumar wrote: > > > On Sun., Sep. 20, 2020, 10:19 a.m. Shrikant Bhende, < > shrikantpostgresql@gmail.com> wrote: > >> Hello all, >> >> I am facing issues with one of the queries running on* Amazon Aurora (PG >> VERSION 9.6)* which is taking more than a minute to complete. As per the >> initial investigation I assume that one part of the query is taking a >> sequential scan on a table("wldbowner.member") which is consuming most of >> the execution time. I tried to use index (Btree and GIN ) as well but none >> of them were helping to get the query to run faster. Attached is the query >> along with the explain analyze of the same, any help on the same would be >> appreciated. >> >> NOTE : I have done the vacuum on the table already to get rid of bloat >> issues. >> Reindex and test with more work mem is also helping. >> > Just wanted to clarify one thing before looking at the query. > > What is random_page_cost set to ? > > >> Thanks and regards >> >> >> --00000000000061f24905afbefd9c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

show seq_page_cost; =C2=A0 1
=
show random_page_cost; 4

storage type : SSD=C2=A0
=
Table size : 39 GB=C2=A0

There are = no columns added, also I haven't found anything where we need to update= the data for older rows.

Thanks=C2=A0
=
On Sun= , Sep 20, 2020 at 6:55 PM Avinash Kumar <avinash.vallarapu@gmail.com> wrote:


<= div class=3D"gmail_quote">
On Sun., Se= p. 20, 2020, 10:19 a.m. Shrikant Bhende, <shrikantpostgresql@gmail.com> wr= ote:
Hello all,=C2=A0

I am facing issues with one of th= e queries running on Amazon Aurora (PG VERSION 9.6) which is taking = more than a minute=C2=A0to complete. As per the initial investigation=C2=A0= I assume that one part of the query is taking a sequential=C2=A0scan on a t= able("wldbowner.member") which is consuming most of the execution= time. I tried to use index (Btree and GIN ) as well but none of them were = helping to get the query to run faster. Attached is the query along with th= e explain analyze of the same, any help on the same would be appreciated.= =C2=A0

NOTE : I have done the vacuum on the table = already to get rid of bloat issues.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0Reindex and test with more work mem is also helping.
Just wanted to clarify = one thing before looking at the query.=C2=A0

What is random_page_cost set to ?=C2=A0


Thanks and regards


--00000000000061f24905afbefd9c--