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 1jKOrL-0005bY-Ap for pgsql-performance@arkaria.postgresql.org; Fri, 03 Apr 2020 16:07:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKOrJ-0004xe-Bo for pgsql-performance@arkaria.postgresql.org; Fri, 03 Apr 2020 16:07:53 +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 1jKOrJ-0004xX-0J for pgsql-performance@lists.postgresql.org; Fri, 03 Apr 2020 16:07:53 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jKOrG-0004Nr-GO for pgsql-performance@postgresql.org; Fri, 03 Apr 2020 16:07:51 +0000 Received: by mail-qt1-x844.google.com with SMTP id m33so6886756qtb.3 for ; Fri, 03 Apr 2020 09:07:50 -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=6lEKImtjoF/WJUk1CHhmRTIHkZ3OhxyOEW22kkAz1Ac=; b=Fa0tZLrxLCd0IeXbFhXmqnapR2Q4pIBE0Hx+0zFyq6qJQn2cDT4ABaUFP5+xKvFPhb tcm7p+r4z7imWDhF6evm2a+7cffMbKSPj4Z2Lzh9zZ12+10BfFQ93VkOx9a6XrvPK+Ap HJ+pHMme8+2/p19Jd5kqBXG3kD4mHYTfMOrawYlx7vzb+HAlRQmK1Y6B4gmDseur3G// aDwKrpKLa8cv/eDcQ+tquAHk/D18JnvB1mS1JHIWkzQbHtfNcZEEIQxV81mAhLRP4HJW vwW4Ix25gv8QC64v/I9O/Vhk/SJmpdvPWxxYx5IxGlEofqB7tGWqtSUVdhKMfN8ixROX KcNQ== 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=6lEKImtjoF/WJUk1CHhmRTIHkZ3OhxyOEW22kkAz1Ac=; b=fmUdl3spJCAFVyWH/a077t9iF7whjiOh+3z/WBeGL8VRNpdPOlwYt5fHaOEHiwqBs9 ++hBlyMPRfH+eTsMZJ9fCAu5JUXCFtRaURr1Z+qQCubNb/UKcP0eVLFwDg4PQNrJhiib aJdh9voa6DspGCFgW45b5BkwAr3ivlMFDbwo26pIbhmvqttFkcW24+grJMBmFTlJ7eCQ yKOcXys9MOJIAm9r+Ibox4FHspwiMk+7VaYZXDXkqrhJYeDFnhcFp8LI4PCO4FY1cWd8 KPvbG3RzipE+lpUrbc5sDTGAnHkmlIRJQO0UWwc/WmnQDtQrkqZwS8mkBTtRpdulI6Hw 6PkA== X-Gm-Message-State: AGi0Pub5vHLiyxRxpsneYjk/r5aEQ4/vwRpxWTdlgssuHyfAqjnqtIls N+CPtvoaPzCBb5QCnn+AFp5KUg== X-Google-Smtp-Source: APiQypI0qT0CRyQ50sMKACjfzd5A+/SyXz+OQD7oWVukklZJHp/iXHyFF3MV1iFLTK2iKiPgldwJ3Q== X-Received: by 2002:aed:2c06:: with SMTP id f6mr8796158qtd.337.1585930069665; Fri, 03 Apr 2020 09:07:49 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id q34sm7030460qtb.41.2020.04.03.09.07.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2020 09:07:48 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 4C1C48007F7; Fri, 3 Apr 2020 11:07:47 -0500 (CDT) Date: Fri, 3 Apr 2020 11:07:47 -0500 From: Justin Pryzby To: dangal Cc: pgsql-performance@postgresql.org Subject: Re: slow query Message-ID: <20200403160747.GP14618@telsasoft.com> References: <1585929829525-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585929829525-0.post@n3.nabble.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Apr 03, 2020 at 09:03:49AM -0700, dangal wrote: > Dear I have a question to ask you > I am having a slow problem with a query and I am seeing with the explain that the current cost and time differ by 4 times The "cost" is in arbitrary units, and the time is in units of milliseconds. The cost is not an expected duration. > Postgres version 9.5.16 in centos 7.6 > To try to solve this run the statistics to the table and the same problem > remains > It's a very big table 2 billion tuples > Do you have any idea what I can do to improve > Thank you very much for your time > Any data you need I can provide Please check here. https://wiki.postgresql.org/wiki/Slow_Query_Questions > I share a part of the explain It's not very useful to see a fragment of it. -- Justin