AW: query performance after database rename

From: "Zwettler Markus (OIZ)" <Markus(dot)Zwettler(at)zuerich(dot)ch>
To: Don Seiler <don(at)seiler(dot)us>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: AW: query performance after database rename
Date: 2018-11-21 15:41:59
Message-ID: 2517bbd286ed41388e4a474314682e76@zuerich.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

Don't ask me why. ☹

Both databases have the same structure.
Both databases are in use before and after the switch.
Buffer cache should be warm, statistics should be up-to-date, therefore.

Thanks,
Markus

Von: Don Seiler <don(at)seiler(dot)us>
Gesendet: Mittwoch, 21. November 2018 15:54
An: Zwettler Markus (OIZ) <Markus(dot)Zwettler(at)zuerich(dot)ch>
Cc: srinivasoguri7(at)gmail(dot)com; pgsql-admin(at)lists(dot)postgresql(dot)org
Betreff: Re: query performance after database rename

On Wed, Nov 21, 2018 at 6:22 AM Zwettler Markus (OIZ) <Markus(dot)Zwettler(at)zuerich(dot)ch<mailto:Markus(dot)Zwettler(at)zuerich(dot)ch>> wrote:
Hi,

Customer claims about application slowdown after such an database exchange.
I will debug the cluster to get more in-depth in-sight.
No connection pooling used.

Thanks,
Markus

We have to exchange two databases db1 <=> db2.

alter database [db1|db2] with allow_connections=false;
select pg_terminate_backend (pg_stat_activity.pid) from pg_stat_activity where pg_stat_activity.datname in ('db1', 'db2') and pid <> pg_backend_pid();
alter database [db1|db2|temp] rename to [temp|db1|db2];
alter database [db1|db2] with allow_connections=true;

Version 9.6

Off the top of my head, I'd say after switching to a new database, you'd have a cold buffer cache. There's a possibility of old statistics. Are you syncing data changes from the old DB to the new DB?

Also, I'm curious *why* you're doing this.

--
Don Seiler
www.seiler.us<http://www.seiler.us>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jonah H. Harris 2018-11-21 16:06:59 Re: query performance after database rename
Previous Message Don Seiler 2018-11-21 14:53:41 Re: query performance after database rename