Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0Vzp-00046H-Ky for pgsql-performance@arkaria.postgresql.org; Thu, 13 Sep 2018 18:05:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g0Vzm-0008Qi-GB for pgsql-performance@arkaria.postgresql.org; Thu, 13 Sep 2018 18:05:38 +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.89) (envelope-from ) id 1g0Vzm-0008Qb-1N for pgsql-performance@lists.postgresql.org; Thu, 13 Sep 2018 18:05:38 +0000 Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g0Vzj-00019J-1S for pgsql-performance@lists.postgresql.org; Thu, 13 Sep 2018 18:05:36 +0000 Received: by mail-it0-x22c.google.com with SMTP id e14-v6so9080671itf.1 for ; Thu, 13 Sep 2018 11:05:34 -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:content-transfer-encoding:in-reply-to :user-agent; bh=11brENsVfKW8UKaJukDm6ZhR33o/jdO9bzsjmrZXoc0=; b=2F/lL+lum2o7esEVVhCUQHyIzz3Err2sT+X+aj8ej4wQ78qCeu41L8Qw/ZpmQhTV/3 4aWkWByMaZ9KxfX/O5XhfL31an4QdKbOpCCLNaQfRUBIOW6se8ut+fLWtG5QDc5PtqPj AlKhXgKjb6uHoWBuU5MlC+T0h8CDf0V3iYQi8xA21gfirft8MT5mabKhvQuxMtefYQjv zxGk4+Z4Hf91o3Wn1h4DcEq+N98Tj1iNOT1GFqjKUDzH14NwYrE2pwsITEOxb+b0qhhn YgedxvFjBSAJ+Q5vS/W9xjOuJeHdCLG82Caxy+xlzbcMo26Wrs28YSR2KdM0ePIVh10a msbw== 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:content-transfer-encoding :in-reply-to:user-agent; bh=11brENsVfKW8UKaJukDm6ZhR33o/jdO9bzsjmrZXoc0=; b=rdAoa7jMZZd1OgVDhVmq3LN+6wZt8gxDlvRLxCpNYd8+fJlpE1/HSMFDHlynS9ARx4 XjIQ0btrBFWODQZBBIN1DENeOFHzWxs5tSaPCEPdW4x8aPUGctLnEmresjNM8p2Hs0ix Mhydmwmlwyt3xAU1RAdFWFTiiqEXiiUjMoLdlmE+5C0u8NS+1WFPeBTwGA0qdxgS3v7K tPzPSUgbZ0INsDuZmsUKgoAz3bopiQmmU9qnUHX5R4LEMspBhdIAI/+ElcTLz6ZJLLz3 tlFN+FFwDC2gY59gQbWW46rrvMvpN6KAInDc5+tfUk872r6lOq1lyvJ6o6u6Ey/RKSFP fNig== X-Gm-Message-State: APzg51DI2eW0DLQLNC910+Tqc2/dJYOtP7oqlOPCmfiRUowwxOifdFPy iPYyep68MESFkjdGkGOeCrrnTw== X-Google-Smtp-Source: ANB0VdYtVGj4MzdCtNNYHilG25gij6rDXLKX7FSjUR+cRV0xNj3BXj/MOasIdv3XSmeVTe8u3iFpmw== X-Received: by 2002:a24:9301:: with SMTP id y1-v6mr7362416itd.29.1536861934311; Thu, 13 Sep 2018 11:05:34 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u204-v6sm2023817itb.34.2018.09.13.11.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 11:05:33 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id A4B228025FB; Thu, 13 Sep 2018 13:05:32 -0500 (CDT) Date: Thu, 13 Sep 2018 13:05:32 -0500 From: Justin Pryzby To: Fd Habash Cc: "pgsql-performance@lists.postgresql.org" Subject: Re: Select count(*) on a 2B Rows Tables Takes ~20 Hours Message-ID: <20180913180532.GD11702@telsasoft.com> References: <5b9a9f81.1c69fb81.43388.0e8b@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5b9a9f81.1c69fb81.43388.0e8b@mx.google.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Sep 13, 2018 at 01:33:54PM -0400, Fd Habash wrote: > Is this ET expected? If not, what could be slowing it down? I’m currently running explain analyze and I’ll share the final output when done. explain(analyze,BUFFERS) is what's probably interesting You're getting an index-only-scan, but maybe still making many accesses to the heap (table) for pages which aren't all-visible. You can maybe improve by vacuuming (perhaps by daily cronjob or by ALTER TABLE SET autovacuum threshold or scale factor). -- Justin Pryzby System Administrator Telsasoft +1-952-707-8581