pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrei Lepikhov <lepihov@gmail.com>
To: Sajith Prabhakar Shetty <ssajith@blackduck.com>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Cc: Peter Geoghegan <pg@bowt.ie>
Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Date: Thu, 15 May 2025 16:26:42 +0200
Message-ID: <2a8243eb-a8e8-4c2d-9c46-7152782d84f8@gmail.com> (raw)
In-Reply-To: <PH7PR19MB6481278D3A55C8BD04B9B9EDB590A@PH7PR19MB6481.namprd19.prod.outlook.com>
References: <PH7PR19MB6481278D3A55C8BD04B9B9EDB590A@PH7PR19MB6481.namprd19.prod.outlook.com>

On 15/5/2025 07:33, Sajith Prabhakar Shetty wrote:
> Hi,
> 
> 
> Most of the queries got slower after upgrading our postgres from version 
> 15 to 17 using pg_upgrade. I reconfirmed that "vacuum full, analyze" 
> were all taken care.
> 
> To debug, instead of upgrade, I installed two instances one with 
> postgres 15 and another postgres 17 with the same application dump restored.
> 
> Now surprisingly one of the query i took from application which used to 
> execute in 2s in PG15, is now taking 1min+ in PG17. I also observed that 
> some of the operations involving DML operations slowed down too in PG17.
> 
> Explain plan of the two queries almost same, all the joins and paths 
> used are exactly same.
> 
> Could anybody please provide some insights here?
Curious, the difference in Index Only Scan node:

->  Index Scan using stream_file_pkey on stream_file sf
     (cost=1.63..1.86 rows=1 width=8)
     (actual time=0.006..0.006 rows=1 loops=598916)
     Index Cond: (id = sdo.stream_file_id)
     Filter: (component_id = ANY

->  Index Only Scan using ui_stream_file_id_component on stream_file sf
     (cost=0.43..0.51 rows=1 width=8)
     (actual time=0.014..0.014 rows=1 loops=598916)
     Index Cond: ((id = sdo.stream_file_id) AND (component_id = ANY

Each time the index scan is 2.5 times slower on PG17. But:

PG 15:
Buffers: shared hit=2338397 read=57267
I/O Timings: shared read=3384.286

PG 17:
Buffers: shared hit=1909772 read=9933
I/O Timings: shared read=686.506

If I'm not mistaken, it seems like an insight.

-- 
regards, Andrei Lepikhov





view thread (54+ messages)  latest in thread

Message-ID: <2a8243eb-a8e8-4c2d-9c46-7152782d84f8@gmail.com>
Permalink:  ../2a8243eb-a8e8-4c2d-9c46-7152782d84f8@gmail.com/
Also on:    postgresql.org/message-id/2a8243eb-a8e8-4c2d-9c46-7152782d84f8@gmail.com

 · 

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: pgsql-bugs@postgresql.org
  Cc: lepihov@gmail.com, ssajith@blackduck.com, pgsql-bugs@lists.postgresql.org, pg@bowt.ie
  Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
  In-Reply-To: <2a8243eb-a8e8-4c2d-9c46-7152782d84f8@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox