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 1pUU0B-0005Bp-RR for pgsql-general@arkaria.postgresql.org; Tue, 21 Feb 2023 14:52:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUTzC-0008Iz-N2 for pgsql-general@arkaria.postgresql.org; Tue, 21 Feb 2023 14:51:18 +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 1pUTzC-0008Iq-CU for pgsql-general@lists.postgresql.org; Tue, 21 Feb 2023 14:51:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUTzA-0002iT-52 for pgsql-general@lists.postgresql.org; Tue, 21 Feb 2023 14:51:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 31LEpE0F3952334; Tue, 21 Feb 2023 09:51:14 -0500 From: Tom Lane To: Ryan MYJ cc: pgsql-general@lists.postgresql.org Subject: Re: Hi All, In-reply-to: References: Comments: In-reply-to Ryan MYJ message dated "Sat, 18 Feb 2023 08:00:18 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3952332.1676991074.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 21 Feb 2023 09:51:14 -0500 Message-ID: <3952333.1676991074@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ryan MYJ writes: > Currently I'm working on upgrading a postgresql version from 9.3 to 12. = The > database size is around 700G. > I finished the pg_upgrade process but when I ran 'analyze_new_cluster.sh= ' > it stucked at the first log 'vacuumdb: processing database "otdb": > Generating minimal optimizer statistics (1 target)'. > Then I checked the active query, the following query has been running fo= r > several hours: > pid | db | start | lap | > query > ---------+-----------+-------------------------------+-----------------+= ------------------------------ > 1822933 | otdb | 2023-02-18 03:02:36.035755+08 | 04:56:41.408329 | > ANALYZE pg_catalog.pg_class; You omitted the pg_stat_activity columns that could give some insight into why this is waiting. The first thing I'd think of though is that it's blocked waiting for a lock, in which case looking into pg_locks to see what is blocking it could help. regards, tom lane