Re: Query Performance after pg_restore

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Murthy Nunna <mnunna(at)fnal(dot)gov>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Query Performance after pg_restore
Date: 2023-12-25 01:06:08
Message-ID: ab3ef39fa330b2ea4aabbf7b768c22b9268f793b.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Murthy Nunna 2023-12-25 18:04:43 RE: Query Performance after pg_restore
Previous Message Ron Johnson 2023-12-24 17:18:58 Re: Query Performance after pg_restore