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

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: [EXT] Improve "select count(*)" query - takes more than 30 mins for some large tables
Date: 2022-07-13 13:16:27
Message-ID: 3dc59390-b2ab-4ccb-3e3f-cc7a1c095829@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 7/12/22 21:28, Scott Ribe wrote:
>> On Jul 12, 2022, at 8:12 PM, MichaelDBA <MichaelDBA(at)sqlexec(dot)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 random I/O kinda way (like I said-->"The heap always gets accessed for select counts") because visibility info is only found in 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,

How recently is "recently"?  And does VACUUM clean it up?

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Goti 2022-07-14 04:13:46 Check Postgres DB open mode
Previous Message Mladen Gogala 2022-07-13 02:54:50 Re: [EXT] Re: Improve "select count(*)" query - takes more than 30 mins for some large tables