public inbox for [email protected]  
help / color / mirror / Atom feed
From: Siraj G <[email protected]>
To: [email protected]
Subject: Performance difference between Primary & Secondary in the query execution
Date: Thu, 17 Oct 2024 19:38:06 +0530
Message-ID: <CAC5iy60Fju3h0qrOS5M70G58fc_d69YTOD20vwr5bWnW1B5AQg@mail.gmail.com> (raw)

Hello Experts!

We have a PgSQL instance running with HA (secondary is being in sync with
streaming replication). Both the ends, we have same version, but not sure a
few SQLs behave badly in the secondary:

Primary:
PostgreSQL 12.20 (Ubuntu 12.20-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit

OS: Ubuntu 20.04.6 LTS \n \l

Secondary:
ostgreSQL 12.20 (Ubuntu 12.20-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit

OS: Ubuntu 20.04.6 LTS \n \l

The application consumes more data from secondary, hence the server has
extra vCPUs.

Can you please advise what needs to be checked.

FYI, I am attaching the query with the different execution plans.

Regards
Siraj


Attachments:

  [application/octet-stream] bad-explain-secondary (5.6K, 3-bad-explain-secondary)
  download

  [application/octet-stream] explain-primary (5.0K, 4-explain-primary)
  download

  [application/octet-stream] query (2.4K, 5-query)
  download

reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Performance difference between Primary & Secondary in the query execution
  In-Reply-To: <CAC5iy60Fju3h0qrOS5M70G58fc_d69YTOD20vwr5bWnW1B5AQg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox