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 1wdB6M-003wMg-23 for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2026 18:16:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wdB6L-00C8Ls-0u for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2026 18:16:29 +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.96) (envelope-from ) id 1wdB6K-00C8Lk-37 for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2026 18:16:28 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wdB6I-00000000OKR-2lvf for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2026 18:16:28 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 435841D0005A; Fri, 26 Jun 2026 14:16:25 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 26 Jun 2026 14:16:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1782497785; x=1782584185; bh=TbOUcavOM2GgwTg7PsaHl0kGK+jYAAQPeS9M50VoZHM=; b= XN6AKtHqIzjKBerw8qQfhO0pjlxYU5oQe6oyg/KtSpBbzmpM6X+s6l3x5mHXxRiE d9ZZjqsDpMeJgabBxQs9iQK4RsjYTFWPQh/AKtcaejGJzEgxWWgXAcd5Wwfhmfkv TfMSkUYQwFY+ylDHxhUveX7CX5s6RqtS6ppox3Ho5dww4balsufiNmrWgrp9rOUL A3Pf++WQAATxy4T9C3jAHwmZQB06VeDFdy0HhXrRA0VV4TlbBRGQSz12cNS4HwtM 2OOYRRo1cm++0OTXedU12ylFCG2uiPiJckQh9mo3+BPAn5BgxEcjoaemUWO0xrT6 IFXq+ZZ8A7fU0+Tv7GobNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1782497785; x=1782584185; bh=T bOUcavOM2GgwTg7PsaHl0kGK+jYAAQPeS9M50VoZHM=; b=Qc58O2j0vGbPHFcUx b9i4KeneUze0gB/JjkQgG6hR6dMvUXVPvpKsQGEXeoVJdFAovgQOgfeuYV82CKZE rIeKwyyx7WClRHocqBS8AbGb1xqP2QVnJIBm+AbWsQ2up6I5aahmGGKaZMuzuJQH RHoxQhjE0rF8zAdUn1jdh8ue43VRxIhSqu7EkydQT9NASvUaUXv7+muma7mMdQdc 7ItC7awp9DwmRNMGPqMnufGlahG0MhgMitBS5S52V5GDPawYENHYuGLGB2KvMmu3 gjjfyEow70OSJZKyv/oBjttyTohy6YCxX0Xm4Ub0q/7vPSFW2m5Tg5yJP7fnHA51 6hKlg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEu4HoIVbFQ+VN0o8X92upR5FxUaHoMQ1IKM/2CRgEEu/snA3mco/hLif65xJwP/d q8rGvKX+ughwgw4UIukDLz9Fx6bpkY7mRzRmzM8Y6r+qlShy0cr5t+GHjBPm+Sd9wKmAOl VFn6K+fgvuMobFyO1J/KXvlqiiaHwNNdyX4nSKrtocpzW2XSdf7shA6ANP8S3ORbXYFtYV 3n8K+XGqCLPupqAhuo3305PbxWj2nnuN375O2nJgkNG6nAwK/WydHUBF3Ssex9WpTfmelw s2gVSCzWDlcjgSuTCMG5iSxEN1hM/SRv6DKulB4TUxF7uNn1vVNhl1ZsmitdzOB0TbyBJt j+kaSqU66goUUXCM3zXy75eCk4mMBrDtUrs3/My+nEG7B0CGrtipiHtLeNE/7UbEripadQ ++tm/9Kro2R1FOwm3evGG/uWw7Rab1lG2ai1F922PqGpJKSi69v8B74x8ViNHFHhVbOtuY /97I10COdbWKq/Z89uIrl8rNjdKY7RFXA4022QGr2hbqJjiPA86Xo5Kvx88d4ZueSJ25QS tapfGgEDBmM0wWC8hHQWaA9bl9GkvTaUMOW1YxWQgywTd6mMpp9FIfujaTaGYjbRUUKNQR /ahHpBv0UwWb4hMIpa3k4mECUem2bmTChjLHLO1ahAyhzG4DIYXxEDVYBiSQ X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Jun 2026 14:16:24 -0400 (EDT) Message-ID: <064ae3fd-b34e-4c72-94dc-5c5173d999a0@aklaver.com> Date: Fri, 26 Jun 2026 11:16:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PostgreSQL 15-->18 slowdown? From: Adrian Klaver To: Israel Brewster , PostgreSQL General References: <4A6D9280-1409-42A8-9A1F-99E2A558E2BB@alaska.edu> <2ce465f0-f7f3-4c6a-9f68-b53439416336@aklaver.com> Content-Language: en-US In-Reply-To: <2ce465f0-f7f3-4c6a-9f68-b53439416336@aklaver.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/26/26 11:14 AM, Adrian Klaver 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 ) 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? Yes you did: "I get a command timeout after at least half an hour" Was not thinking. >> >> 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 = off; Lo and behold, the query ran in >> only 123.888 ms (fun number :-D ) - https://explain.depesz.com/s/K2K9 >> > > This one does not show the actual query. > > >> --- >> 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 >> > > >