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.96) (envelope-from ) id 1wdB99-003wOc-0y for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2026 18:19:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wdB98-00CFpZ-0l for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2026 18:19:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wdB97-00CFpF-2b for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2026 18:19:21 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wdB94-00000000N5i-3nxv for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2026 18:19:20 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2c7edca2a94so1237615ad.2 for ; Fri, 26 Jun 2026 11:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alaska.edu; s=google; t=1782497958; x=1783102758; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:content-type :message-id:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ek9Jh+xULr5Bw0PREP63Q5glKe68WSSzgtdb9bPjXvo=; b=IFBo6eOQnwAKEkbUKTDni7wPg7VYweD9IMrsYzV8GsY1qxAWznujlPJGuWbEWqlOSk IQ/p5CwL9ObKSYYGlETKQJlh76S+/91Ia0YnHevgBjCK7QfP8aoE3I8dYSpXfgUvOGE2 iZAJI+J65M6kV/NfXHE0tA5ID8A8nBegN6FcA/lxmAk147drd8yDXeoS8K92JcKkwPrb 4LdZFvWiJ3uPuQE8HdOxRhYZT+Zx0HAFofQaidvCg4o48XRIRMRMEC8+S0Yz2jI0CaaD kqMmotEWpmAxBzJs6C6H8QaKqLiPRQ4nWeIWE8mmCnXIfRBIQhbe3s8ZoUzCDXr23QHm pvSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782497958; x=1783102758; h=references:to:cc:in-reply-to:date:subject:mime-version:content-type :message-id:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ek9Jh+xULr5Bw0PREP63Q5glKe68WSSzgtdb9bPjXvo=; b=MHSzK2QXzyVQXH15En248S0wqsMrZZFu3QTF3WUN0y4nJ/W9vrxeGLdFDnn864OosX MAUeSm/JwbMHmdulw0Ims1y/VSbG8zzoAxlhC9w3s9bBmEk2Z8/u4atRPtxVsFXkks5I 4OTtRlNZHaMtNHEu5VDVCnrsJO3Z52TWN9D4ePTsoy6ew87QAbuGZKlKILQ9F8d0kaEw cqYV43YSB9rxshgIjBU5QZohM1QRjA9797XfRYv121+1KsmlqX6+MejAT4hLzcTT0SJe J7wn1v93PRAbMxyLNbUWuAQs6aGT7amBeV5FEL0EqOX3pceqrRG4OXzcEuW+0uOHMubY LBhA== X-Gm-Message-State: AOJu0YwjQAlWFtJMxC9vfV7V9QQaOP+tQJ565uvWYhXod+7HqWMPAaUT dShKeD0MdceulaCc59aUL66r2TfFmBLkWKEWOD/TvA1zCFbxvgcZc9pock722pSCcw== X-Gm-Gg: AfdE7cnTWWCIz8gqVQxhOoqJusjH9YqPeLDphLR0be572HOv2AOBYfpJE64jQT5zsHB JP/pmUePgXKyQstEZGsoNV9t0dWqc0+Tac8am00nime7dGg+Z2/p3P9GOWCb9ePV3iYnttkxq+N vJdMe++eR0+pTcT77g3ZEmXFrvA40ZqzomKh5eOuPiT0ZGum0qocLyncdowcIK+DND0HlaevbOw CjnYQngAvnP5p0e77M5e++Dw2becWUG4cnAfqPJR9v8TgzXNqPviIjcN/kQX7C61YsZf0vrfz1D ICsiOUAF2nvn7Jj68MuglmVLAqtu2wqgnywe+BF1fvEGIJ2Tk7jeqrLAlQ4adNqHT8CJ+BhEHqE 6Z8gnMLMrfOxQpkRGIR67xng33gUqBhiS+KFzUeLmnxVm1I0yR95jd+aZLW37EedtUBSZU4Dm98 sSBAeqXCNNZo3loZW7BD4aILmnd3Bo9TLEjQPPFcbANhwMkwxFOMvkWXVUZonmzic1BwjvBkatI EbrcoGU X-Received: by 2002:a17:902:c951:b0:2c0:c262:b928 with SMTP id d9443c01a7336-2c7fc629f01mr35558525ad.2.1782497958066; Fri, 26 Jun 2026 11:19:18 -0700 (PDT) Received: from smtpclient.apple (63-140-92-92-radius.dynamic.acsalaska.net. [63.140.92.92]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c7f63b2be2sm44861375ad.47.2026.06.26.11.19.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2026 11:19:17 -0700 (PDT) From: Israel Brewster Message-Id: <9FB992C2-0A1D-4BFE-8066-77F130471B9B@alaska.edu> Content-Type: multipart/alternative; boundary="Apple-Mail=_4AA73510-97BE-4B9F-BC0C-24F31AB75FF6" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: PostgreSQL 15-->18 slowdown? Date: Fri, 26 Jun 2026 10:19:06 -0800 In-Reply-To: <2ce465f0-f7f3-4c6a-9f68-b53439416336@aklaver.com> Cc: PostgreSQL General To: Adrian Klaver References: <4A6D9280-1409-42A8-9A1F-99E2A558E2BB@alaska.edu> <2ce465f0-f7f3-4c6a-9f68-b53439416336@aklaver.com> X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_4AA73510-97BE-4B9F-BC0C-24F31AB75FF6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On Jun 26, 2026, at 10:14=E2=80=AFAM, Adrian Klaver = wrote: >=20 >=20 >=20 > On 6/26/26 10:58 AM, Israel Brewster wrote: >> In postgreSQL 15, I had the below query that worked quickly. Now, I = make no claims that the query is the best possible, or even a good = query, but it DID work, and it did so quickly enough to be un-noticable = when running. >> Then I upgrade to PostgreSQL 18 - and now the query never completes = (as in, I get a command timeout after at least half an hour before I get = a result). Looking at the EXPLAIN (https://explain.depesz.com/s/llAQ = ) makes it pretty obvious why: we = have a sequence scan on a large table inside a nested loop - and that = sequence scan is apparently not short circuiting. >=20 > The link provided shows no times or rows, did you pick the correct = one? >> I tried the obvious: REINDEX database and VACUUM ANALYZE, but neither = helped. I have my default_statistics_target set to 500 at the moment. >> Then I tried SET enable_seqscan =3D off; Lo and behold, the query ran = in only 123.888 ms (fun number :-D ) - https://explain.depesz.com/s/K2K9 = >=20 > This one does not show the actual query. Right, sorry. It=E2=80=99s the same query as in the first one though. = Only difference is sequence scan off. --- Israel Brewster Software Engineer Alaska Volcano Observatory=20 Geophysical Institute - UAF=20 2156 Koyukuk Drive=20 Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145 >=20 >=20 >> --- >> Israel Brewster >> Software Engineer >> Alaska Volcano Observatory >> Geophysical Institute - UAF >> 2156 Koyukuk Drive >> Fairbanks AK 99775-7320 >> Work: 907-474-5172 >> cell: 907-328-9145 >=20 --Apple-Mail=_4AA73510-97BE-4B9F-BC0C-24F31AB75FF6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 On Jun 26, 2026, at 10:14=E2=80=AFAM, = Adrian Klaver <adrian.klaver@aklaver.com> = wrote:



On 6/26/26 10:58 = AM, Israel Brewster wrote:
In postgreSQL = 15, I had the below query that worked quickly. Now, I make no claims = that the query is the best possible, or even a good query, but it DID = work, and it did so quickly enough to be un-noticable when = running.
Then I upgrade to PostgreSQL 18 - and now the query never = completes (as in, I get a command timeout after at least half an hour = before I get a result). Looking at the EXPLAIN = (https://explain.depesz.com/s/llAQ = <https://explain.depesz.com/s/llAQ>) makes it pretty obvious = why: we have a sequence scan on a large table inside a nested loop - and = that sequence scan is apparently not short = circuiting.

The link provided shows no times or = rows, did you pick the correct one?
I tried = the obvious: REINDEX database and VACUUM ANALYZE, but neither helped. I = have my default_statistics_target set to 500 at the moment.
Then I = tried SET enable_seqscan =3D off; Lo and behold, the query ran in only = 123.888 ms (fun number :-D ) - https://explain.depesz.com/s/K2K9 = <https://explain.depesz.com/s/K2K9>

This one = does not show the actual = query.

Right, sorry. = It=E2=80=99s the same query as in the first one though. Only difference = is sequence scan off.

---
Israel = Brewster
Software Engineer
Alaska Volcano = Observatory 
Geophysical Institute - UAF 
2156 Koyukuk = Drive 
Fairbanks AK 99775-7320
Work: = 907-474-5172
cell: =  907-328-9145




---
Israel = Brewster
Software Engineer
Alaska Volcano = Observatory
Geophysical Institute - UAF
2156 Koyukuk = Drive
Fairbanks AK 99775-7320
Work: 907-474-5172
cell: =  907-328-9145


= = --Apple-Mail=_4AA73510-97BE-4B9F-BC0C-24F31AB75FF6--