From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Murthy Nunna <mnunna@fnal.gov>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Query Performance after pg_restore
Date: Mon, 25 Dec 2023 02:06:08 +0100
Message-ID: <ab3ef39fa330b2ea4aabbf7b768c22b9268f793b.camel@cybertec.at> (raw)
In-Reply-To: <DM8PR09MB66777254DC04045815B09196B89AA@DM8PR09MB6677.namprd09.prod.outlook.com>
References: <DM8PR09MB66777254DC04045815B09196B89AA@DM8PR09MB6677.namprd09.prod.outlook.com>
On Sun, 2023-12-24 at 15:53 +0000, Murthy Nunna wrote:
> I did pg_dump of a ~20TB database followed by pg_restore. I find simple queries like select
> count(*) running slow. I did a select count(*) on all tables before pg_dump which took ~4 hours.
> After pg_restore, same thing took 32 hours.
SELECT count(*) is always slow.
> By the way, there is no change in postgres versions. It is 14.4 before and after pg_restore.
You should compare the execution plans of the queries on the old and the new server.
Besides, if you are running lots of count(*) queries, you are doing something wrong:
https://www.cybertec-postgresql.com/en/pagination-problem-total-result-count/#total-count
Yours,
Laurenz Albe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: laurenz.albe@cybertec.at, mnunna@fnal.gov
Subject: Re: Query Performance after pg_restore
In-Reply-To: <ab3ef39fa330b2ea4aabbf7b768c22b9268f793b.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox