Re: [EXT] Improve "select count(*)" query - takes more than 30 mins for some large tables - Mailing list pgsql-admin

From Scott Ribe
Subject Re: [EXT] Improve "select count(*)" query - takes more than 30 mins for some large tables
Date
Msg-id 647F11EE-BBDA-46C1-8591-96B2C1DCE66C@elevated-dev.com
Whole thread Raw
In response to Re: [EXT] Re: Improve "select count(*)" query - takes more than 30 mins for some large tables  (MichaelDBA <MichaelDBA@sqlexec.com>)
Responses Re: [EXT] Improve "select count(*)" query - takes more than 30 mins for some large tables
List pgsql-admin
> On Jul 12, 2022, at 8:12 PM, MichaelDBA <MichaelDBA@sqlexec.com> wrote:
>
> Oh really? Even if it did an INDEX ONLY SCAN, it would still be slower because it still has to access the heap in a
randomI/O kinda way  (like I said-->"The heap always gets accessed for select counts") because visibility info is only
foundin the HEAP not the index. 

This changed in 9.something. There is now a visibility map, which can, for data that hasn't changed recently, greatly
reducethe amount of access required to the heap to determine visibility. 


pgsql-admin by date:

Previous
From: MichaelDBA
Date:
Subject: Re: [EXT] Re: Improve "select count(*)" query - takes more than 30 mins for some large tables
Next
From: Mladen Gogala
Date:
Subject: Re: [EXT] Re: Improve "select count(*)" query - takes more than 30 mins for some large tables