Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmXXU-0000FL-KN for pgsql-general@arkaria.postgresql.org; Wed, 12 Apr 2023 10:17:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pmXXT-0001S7-Hx for pgsql-general@arkaria.postgresql.org; Wed, 12 Apr 2023 10:17:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmD3d-00061V-26 for pgsql-general@lists.postgresql.org; Tue, 11 Apr 2023 12:25:09 +0000 Received: from mail-be0deu01on2135.outbound.protection.outlook.com ([40.107.127.135] helo=DEU01-BE0-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmD3Y-0003K9-1b for pgsql-general@lists.postgresql.org; Tue, 11 Apr 2023 12:25:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0zpduLuVk9luwEISUHiTghCxeEUQSo95JVLFJFiKlomU3mBXIaYIRrBrTdCRuvZN4FBsr3itZOklXu/1AjpzgbJtNzfvfMuP9hwzeQpmgnTzFg29FMSzCnuQhcUbXcMUO33kMkyBPWp9SxJZ/kigGZjgxwYrpgX5domqDsy6bjcxg30afp7H3Rnj6fP8cy2UQLlxEViIkTXX5TPyBnhq+/gxT9EHkKKnJliDUWA5VYCJ8XvwfaQSl1YnF5dJb8hwvfrRbM13Qig17/2yKD2BnR8GRK+tDy3k2iVCG2AgOwYHiUU+5EbmviWTdNMdSr6NAruvHgIHHXoiGOmU3wumA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GU6POtiBa2xrdvnqv6ubNmd8J2RztFwQRoLn+lwMBl0=; b=hsvZNb/7Z1wweJsU6LcjhUJ543hmu+HoWIIAOQK9oiDGekzn+2poDEtA671Du8eOn7WGSCGNFtNc4fdTV2r5vDOTkJxUOAJfQoq+RPQNmuEI/BwtsbOrKgbk5RQqx1B2kZLIMMcuCnwfDPqxF6x0yeKxQ+JHQjw79zsQrUSM2fNe5K6NFCG/GSA9G74TbrLrJcg+8XZPMFimTZa7f8SlNbM3hCiXee+26+QqCnW6/fNIjphoWIoQRpA6xZJ/raF6ezFqsK3vBa3Vi8u147SqxkIDwgnqhJkIIXsobnRpnKKc3C50a+Tzc/ilgmnCADqZ00Vd22/UaW1UtcFYEZcL8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=solvians.com; dmarc=pass action=none header.from=solvians.com; dkim=pass header.d=solvians.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solvians.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GU6POtiBa2xrdvnqv6ubNmd8J2RztFwQRoLn+lwMBl0=; b=etMAMwYr8VAeyhy5jiMjYrbxmSJFXKBPOnetCbsNCuLLsgN6Jj2t9gS6HgpPO/7p6LnbrCLtic/HjEGq+biiCmiSZ0D3rMQTS9Ou6+kz0UosmcsP2K6QSJlk8GsX9YBRPSKiG9A5dMuJSdqKDKZ5j8ZKLCQNsOARvd2/1buxaGU= Received: from FR2P281MB3341.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:64::7) by FR2P281MB1525.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:90::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 12:24:59 +0000 Received: from FR2P281MB3341.DEUP281.PROD.OUTLOOK.COM ([fe80::3e65:1375:3342:d9ca]) by FR2P281MB3341.DEUP281.PROD.OUTLOOK.COM ([fe80::3e65:1375:3342:d9ca%6]) with mapi id 15.20.6277.038; Tue, 11 Apr 2023 12:24:59 +0000 From: =?Windows-1252?Q?Christian_Schr=F6der?= To: "pgsql-general@lists.postgresql.org" CC: Inzamam Shafiq Subject: RE: Performance issue after migration from 9.4 to 15 Thread-Topic: Performance issue after migration from 9.4 to 15 Thread-Index: AdlsYs7uH6UtSjn+TCKoBujcVDmQnwABSHrlAAIQfOA= Date: Tue, 11 Apr 2023 12:24:59 +0000 Message-ID: References: In-Reply-To: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=solvians.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: FR2P281MB3341:EE_|FR2P281MB1525:EE_ x-ms-office365-filtering-correlation-id: 84e68eb7-612f-441b-c0de-08db3a87c459 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rINf1wzBM3k75YlEaZbx2ala++mnbugwo4ybuGM8s/BYkEciMso8J6bimWcbC9ea3z/Ga12lGlanK5ZFcWNZM7FGbyW4hGar3ihwNZK2o611USTkVOjaEJ1NoeUbpu9WMZlSIFympsH+Lt67r3eW0AojxK6uCSEShAie5cDjJEZAs8D71R7fIthmQnYNo1Rckzkd6ZJ8mg5o+iMTMY9vnTuhjT7tnIJEVcyP9NwgZeBF/GG1Znct5GxexhSirfrqZCJ3lDZ4jSjiX1lzpquM6sN/+TrIP/y+u0okalAg4LbcGWaR1S4X+CGVX0+8d2bwG0I116tVO0r83Nf+kci1CUIHqDgRwdkAUaM80Yv1i0iL1EbrRaz8M0b5KsBSH30Qcx9GyZzGlRSAAaulcdv1sTd6r3AsPZxFKEmZ73tjpRRltsareesnTY51RkgHNTXgkCEshQ6qkx3HFLNw/3vZl4v6qDBUiTzi4NVCMtONrZJxkFhRYupRtuKWpho0Xr2undiCS2ayrwqoV6o33hhPeoSNIi4/QjimDuR+qWTUIOQ8MKqYUr0Beevi9/qv15ZwyP2MYgHH2rHGicDiFMCXsoTuF4CZHEaK2wfZwuF2q2xlcfqzUTzRPPUiqYNm3oTb x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:FR2P281MB3341.DEUP281.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39840400004)(366004)(396003)(376002)(136003)(346002)(451199021)(41300700001)(76116006)(478600001)(45080400002)(86362001)(316002)(71200400001)(8676002)(64756008)(66946007)(66556008)(4326008)(6916009)(66476007)(66446008)(7696005)(52536014)(8936002)(966005)(5660300002)(38070700005)(33656002)(186003)(38100700002)(122000001)(26005)(53546011)(6506007)(9686003)(83380400001)(2906002)(66574015)(55016003)(554374003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?4gr2kKpvRPgqotGGR1JpfYnd6btB1LtmoqwlNXjSPW+3NMGsed/fH0Sk?= =?Windows-1252?Q?Lsx4paCEOcr7SWdL8ikBFA2I/0HB1DCfDmXTFL0xQfgJUHO+RAdRDYtn?= =?Windows-1252?Q?uL4qFZvU/Ctaz23L2rgH1eIFW4Aqm8Ap0snwu9SKZE0Encz0Su1rnRUh?= =?Windows-1252?Q?+7v2Yhy6T0JHzFYZrdXUJt1OrcPTjNk69gTksEPA6HFN63Cw+NutTln/?= =?Windows-1252?Q?g7OGg/ElcnugMF2pcFjRyKNiCoVzoSRduU/Txxm2FtkhABKbIW0vXN9e?= =?Windows-1252?Q?o28seyj/KAltrG38S+IB8qBDTo4gUmDwz2/hXVCRB24/JIh3QFes6Fjs?= =?Windows-1252?Q?e+4gDBeAxQTuDwkdJtlb6Twnjrp/jevAJAihnQfMbZGG5MWZ2YJXQ9Rb?= =?Windows-1252?Q?7g75x9BHbF+s8gGXbJUuBrn2HeIlJ+sHR6wwAqbkSLkHwbKRdfbKa2vq?= =?Windows-1252?Q?zJCYeDwGVUPi2E0t3cUIIJxS/OeCx+RSlkLsNc/P36G+jyA/ZSq9duoj?= =?Windows-1252?Q?DQItq04q/zLzTqOQq8iY+0cBkKdnjPDknQ01CNSYwLV3L2n2/WemXm+s?= =?Windows-1252?Q?rfG1NxPRyDwGqsLOC/EBT84MXJvW5x1TrdnrOI0aPxPeBz0xKQted8vw?= =?Windows-1252?Q?VeYPg7iv3PWP/j0wL1tSKMgZavuwFsAAxJX+XsRzQbzHyUVgoH3J9s5b?= =?Windows-1252?Q?Ce1HdyTVFa181Fuv7S8DDfhKCrH6vIsKz1YsVGo8aRHRbnVeANDe5Uwb?= =?Windows-1252?Q?TbxBK5hN3WattHJcGLcmkrRDoU0HdR2CiMxbg7FJUdXE/Wu8ElupTim1?= =?Windows-1252?Q?wYK5ja2UzaiFmnb+1Ulk3w16rJRANXyEqYjvzBWuwjVL+UaA7JA4moNQ?= =?Windows-1252?Q?vZdnSboMnlkoTzFRMJ7RFR+mhIrXenIIj0e7mxGd5vKWsi+4jBwTq/t2?= =?Windows-1252?Q?3ccZwEwmQ225MF4w6JkUPMGG07RTMwUl8UKJLT1W2jBwmu4gI+8HL7yv?= =?Windows-1252?Q?oa5jjvWxvux1QioB7NBIcgGb1+Od/JDdA+5jqIwPyJBqApKQ3OKxnfC8?= =?Windows-1252?Q?rpeEBA7bT3kqha64G0rkGbb4OrPpXeQKu1vQaApLmcwqZc8nyDS0cYAE?= =?Windows-1252?Q?cvB9pVtp87NEo+U8hY9hLahgw+7BSu57HUJRh94TRE6cSUXM+BPD6VXR?= =?Windows-1252?Q?JoJSBgtJXG2gGsQIRD65hx3e4CghP/WrGdx5BobdJ9tIQpRuDT6f9VRG?= =?Windows-1252?Q?+rTfpXv5e7gjdFnOfHxNDpjr/spHBnf8iaPZzsR0dDaSMxxGegXXPdGf?= =?Windows-1252?Q?ngBQw4juicmjGeJR16h5GjvjSlPTQxjHhFxEur7zPLA12JdwyIEfMz2B?= =?Windows-1252?Q?ND0CDHFlFfDY9h1nlBvOCUKR229exskzrOGz9MLboBLG6NX+l/MXLCSv?= =?Windows-1252?Q?ibwFmYtlNcE1d2JrB7cYUmtboIrIFKB1oQhMnbY2F6pXI9/dNqZ1x4t9?= =?Windows-1252?Q?qpdyeAFXJ8gzZq1aGwspwNWfNYWK4tSkqxHLCyhPl8mBxz2C/hl95Y38?= =?Windows-1252?Q?qauZC6LN+O67ueUuJAwplU6CNGrBk+M8C3gmoqTWHebTSUFtAjxr9le8?= =?Windows-1252?Q?xBHHJGw6DtNW1JB0GGTR1Z43MGj6SRVpY2BBy0Pvup7lad0e2iHuWDn+?= =?Windows-1252?Q?cFtV+LmPb9GnGMLp+XjNwkYOC53i+159usbXyWGX1OcZ7FqliNqlhg?= =?Windows-1252?Q?=3D=3D?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: solvians.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: FR2P281MB3341.DEUP281.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 84e68eb7-612f-441b-c0de-08db3a87c459 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2023 12:24:59.1904 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 621e6219-3ff9-4100-b0e6-fbe83e87c529 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eUudXyRWxV/aEwHJygJEt8sphzGMeNx5nNjsfifpBqBphxj0gW10fVhuvHW+oeNwc3o3ecPf/UdB/gUoHNgWj3caEQbjmjQgleXIE/KqHxVcVH6ZGmaOKLbToT1pnQWE X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB1525 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I will definitely give it a try; however, I do not understand how this coul= d explain the observed performance changes. As far as I understand, an outd= ated/non-optimized index would not be relevant in a sequential scan, and ou= tdated statistics could cause a non-optimal plan to be chosen, but they sho= uld not affect the performance of a single sequential scan. Best, Christian From: Inzamam Shafiq Sent: Tuesday, April 11, 2023 1:25 PM To: Christian Schr=F6der Subject: Re: Performance issue after migration from 9.4 to 15 Hi, How did you upgrade the databse? if it is done by pg_upgrade then I think y= ou have to do the following, Try re-indexing the database Update/analyze statistics Regards, Inzamam Shafiq Sr. DBA ________________________________________ From: Christian Schr=F6der Sent: Tuesday, April 11, 2023 3:58 PM To: mailto:pgsql-general@lists.postgresql.org Subject: Performance issue after migration from 9.4 to 15 Hi list, We have recently migrated from our old PostgreSQL 9.4 server to a PostgreSQ= L 15 server. Even though the new machine has more resources, we see a consi= derable decrease in the performance of some of our heavier queries, and I h= ave no idea where I should start tuning. ? Old database: PostgreSQL 9.4.26 on x86_64-unknown-linux-gnu, compiled by gc= c (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17), 64-bit New database: PostgreSQL 15.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC)= 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit I tested the same query against the old and the new database. Old: https://explain.dalibo.com/plan/b7d7gab73f6c7274#plan/node/21 New: https://explain.dalibo.com/plan/84h16cg1f19266be#plan/node/34 Particularly interesting are the sequential scans. In the old plan, we have= node #21, which took 32 seconds. Almost all of the time goes into actual I= /O. In the new plan, the corresponding node is #34. It took 55 seconds, but= less than 1 second was actual I/O (because most of the data was already in= memory). Why did this step still take about twice the time? There is another Seq Scan of the same table. Node #10 in the old plan took = 3 seconds, whereas the corresponding node #21 in the new plan took more tha= n 2 minutes (of which less than 2 seconds was actual I/O). Am I misreading the plans? If not, I have no idea why the sequential scans = take so much longer in the new database, even though the I/O is even faster= than before. The configuration was left almost unchanged, with only some adjustments due= to changes between the versions. As far as I can tell, none of these chang= es is performance related. Can anybody give me a hint into which direction I should investigate furthe= r? Thanks, Christian