Re: Select count(*) on a 2B Rows Tables Takes ~20 Hours - Mailing list pgsql-performance

From Justin Pryzby
Subject Re: Select count(*) on a 2B Rows Tables Takes ~20 Hours
Date
Msg-id 20180913180532.GD11702@telsasoft.com
Whole thread Raw
In response to Select count(*) on a 2B Rows Tables Takes ~20 Hours  (Fd Habash <fmhabash@gmail.com>)
List pgsql-performance
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
finaloutput 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


pgsql-performance by date:

Previous
From: Fd Habash
Date:
Subject: Select count(*) on a 2B Rows Tables Takes ~20 Hours
Next
From: Tom Lane
Date:
Subject: Re: Select count(*) on a 2B Rows Tables Takes ~20 Hours