Improve "select count(*)" query - takes more than 30 mins for some large tables

From: Raj kumar <rajkumar820999(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Cc: Raj kumar <rajkumar820999(at)gmail(dot)com>
Subject: Improve "select count(*)" query - takes more than 30 mins for some large tables
Date: 2022-07-11 07:16:23
Message-ID: CACxU--UJY4sD2SjW8V3W0oAPuuTzE3fAvBzTaej-BmUUNJxN_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

How can I improve "select count(*)" for larger tables? I'm doing a db
migration and need to validate the data count.
"select count(*) " queries are taking more than 30 minutes for some tables
which is more than the downtime we have.
Will work_mem increase help? or how can i speed up this row count?

Thanks,
Raj

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Florents Tselai 2022-07-11 07:23:01 Re: Improve "select count(*)" query - takes more than 30 mins for some large tables
Previous Message Laurenz Albe 2022-07-11 06:13:16 Re: Storing large large JSON objects in JSONB