Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDlOH-00313C-QN for pgsql-general@arkaria.postgresql.org; Wed, 20 Nov 2024 14:09:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tDlOG-00639a-HW for pgsql-general@arkaria.postgresql.org; Wed, 20 Nov 2024 14:09:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDlOG-00639Q-4P for pgsql-general@lists.postgresql.org; Wed, 20 Nov 2024 14:09:08 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDlOD-002vz4-JZ for pgsql-general@lists.postgresql.org; Wed, 20 Nov 2024 14:09:07 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-720aa3dbda5so4706148b3a.1 for ; Wed, 20 Nov 2024 06:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifetrenz.com; s=google; t=1732111743; x=1732716543; darn=lists.postgresql.org; h=content-transfer-encoding:to:references:message-id:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DHL4Y/uuu+k5qKRzKuSXXOheChDkDmapgktYuOlYwwo=; b=Np+XNhQcjHKx8XdodERoo3heVTKBtN0ijNbIYu2gKMBUHYX6B4CcPaQwHstU7urof/ i6O8mzAhOZmrKegZXKUkOUTZ4BANXjLrcNC7CVk5FVkpFWwYOXHdgkenGl3e/PGwWY6N uYSr1cTXuAvW5x5gfpruj4Vnd8W23xUfrVtdircLesplDPc17O/viQi/l28nO+mlVo5o fEqQFvtq63WGtfSQRmdPnrb+LAm20Phr1TUG35myde0UePLF0+au/Px+rHa85p7VelU+ l62oT3fB7BS21O1+DIfN3kIL77R2SqDAiURhreUrt7VLqi/oKusYBt5o0OOFEPAHC8jH M/sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732111743; x=1732716543; h=content-transfer-encoding:to:references:message-id:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DHL4Y/uuu+k5qKRzKuSXXOheChDkDmapgktYuOlYwwo=; b=QkFeSWwSzBnqSF6zf8sj2clo2jLsaJDkfqGEN5TmRNsBbtZyrOzcLmHmaZEjoONZ3X BrBRaYD4nZ2mfkgWJaQihpey7/5OJftXrck55eOjC+zeatjZWF+sPhA0JPHCITCWoqJ0 FmugUCFe2ZG0qPK2WKdIx7n1T6MwHMCT3OB3XRBZRKz4mtFhylFXnYwacu2JblfQJJW+ ZgNZKZT/o3VWgBr93uDZQO+jHmVHHRwHaVpGxOQ+Ajsn8JFi32Wpg3VJtzmrnPhXYi9a VlttVml7Dikc5tb1QfZvaDDBTgS4tsC1ep6oQyDSzxsjUfwKBAvSQRLIuZwzY3pvCOO4 Pg1w== X-Gm-Message-State: AOJu0YyZgn7biGJ1HeeTZ/u07pxjdoi70F1dtLN2662iG3ATRCObtCDJ alnRtTQKAq4RhNJCxV/jCeLdwVfOuhpzLS5xVgTBgNxHBPOd3RiLySUD1utr3LIxyof9KpB/9Dz E0of4l0QQCVsuWJlEdJ/gF5vOV7YQVSVYldabdA/AmMXy1dW35wnu4DA9wNjoB3p294+rC5hOSO F6 X-Google-Smtp-Source: AGHT+IFw3ExMGTjB4pga9ubcFNr0yqR6ptXsKQRUHtI9RvZkiVFlYyjUJQgBpPtUoBu6DxyBZWuUBg== X-Received: by 2002:a05:6a00:2285:b0:71e:55e2:2c58 with SMTP id d2e1a72fcca58-724becc5a22mr3778576b3a.15.1732111742296; Wed, 20 Nov 2024 06:09:02 -0800 (PST) Received: from smtpclient.apple ([2401:4900:1cc4:895a:5195:a69:b799:60d2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724beefe582sm1635582b3a.56.2024.11.20.06.09.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2024 06:09:02 -0800 (PST) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Subject: Re: Suddenly all queries moved to seq scan From: Sreejith P In-Reply-To: Date: Wed, 20 Nov 2024 19:38:49 +0530 Cc: pgsql-general@lists.postgresql.org Message-Id: References: To: Daniel Gustafsson X-Mailer: Apple Mail (2.3818.100.11.1.3) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 20 Nov 2024, at 6:32=E2=80=AFPM, Daniel Gustafsson w= rote: >=20 >> On 20 Nov 2024, at 11:50, Sreejith P wrote: >=20 >> We are using PostgresQL 10 in our production database. We have around 8= 90 req /s request on peak time. >=20 > PostgreSQL 10 is well out of support and does not receive bugfixes or sec= urity > fixes, you should plan a migration to a supported version sooner rather t= han > later. >=20 >> 2 days back we applied some patches in the primary server and restarted.= We didn't do anything on the secondary server. >=20 > Patches to the operating system, postgres, another application?=20 PostgreSQL Common 10.23-6=20 >=20 >> Next day, After 18 hours all our queries from secondary servers started = taking too much time. queries were working in 2 sec started taking 80 seco= nds. Almost all queries behaved the same way. >>=20 >> After half an hour of outage we restarted all db servers and system back= to normal. >>=20 >> Still we are not able to understand the root case. We couldn't find any = error log or fatal errors. During the incident, in one of the read server= disks was full. We couldn't see any replication lag or query cancellation = due to replication. >=20 > You say that all queries started doing sequential scans, is that an assum= ption > from queries being slow or did you capture plans for the queries which be > compared against "normal" production plans?. Queries were taking 20 ms started taking 60 seconds. So have done SQL analy= se to understand about query plan. There we found that query planner taking= seq scan instead in index scan. I would like to add one ore point. A delete query were running in DB from = 2 days for deleting around 80 million records.=20 >=20 > -- > Daniel Gustafsson >=20 --=20 =C2=A0 *Solutions for Care Anywhere* *dWise HealthCare IT Solutions Pvt.=20 Ltd.* | www.lifetrenz.com *Disclaimer*: The=20 information and attachments contained in this email are intended=20 for=20 exclusive use of the addressee(s) and may contain confidential or=20 privileged information. If you are not the intended recipient, please=20 notify the sender immediately and destroy all copies of this message and =20 any attachments. The views expressed in this email are, unless=20 otherwise=20 stated, those of the author and not those of dWise HealthCare IT Solutions= =20 or its management.