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 1uBH6m-008mLv-J2 for pgsql-bugs@arkaria.postgresql.org; Sat, 03 May 2025 17:57:04 +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 1uBH6j-00FfF2-9U for pgsql-bugs@arkaria.postgresql.org; Sat, 03 May 2025 17:57:02 +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.94.2) (envelope-from ) id 1uBH6i-00FfEu-Tu for pgsql-bugs@lists.postgresql.org; Sat, 03 May 2025 17:57:02 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uBH6g-000t6W-0B for pgsql-bugs@lists.postgresql.org; Sat, 03 May 2025 17:57:00 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43edecbfb46so16589065e9.0 for ; Sat, 03 May 2025 10:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746295016; x=1746899816; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U7peU8NoVTDWI78UhGTLBzUqvEASqndz4NKKi5LP+mY=; b=NX9I9XIY7F+D677YeC+dvTiqRvLJj/9GzCOGRJgQxN6K1m5C+VQIAGjtaEE7a7CSUF WVRI5YksjOqY9O8/y8p1gDgG4DMgW2Mzyq/5OOWceC2Gd3tbsnCjLytOIXrYBP06GR++ m2YTKLoCCmAzIe7ISJxnVPg2d0NnwaElO8vefqR7MxZm5leDnBysB9BQATMtjjEDzSJ+ NUH2B/y9DsyvNXVXjQv5STOagNHKgv+g5W/rE4jY1UntWmIxLR0wzJucQa0qpRKc5K8C o3AA7so7G3oFiXfRilWtPau+yrYLoNEtqafHgeoXgED2KD51+CbM7TrXUliS21kumqgg weSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746295016; x=1746899816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U7peU8NoVTDWI78UhGTLBzUqvEASqndz4NKKi5LP+mY=; b=L1Ry/1oeP8UvyC7tE3Xx+/Jg9YOg0W9W6uMfJnhj7MxyAFaFBmIdsBV9RwWZm93iPU vvSAGb6LCz1wB5oU9KWHzYlvvQ2LalnKU7RxzxVlj9kXKgacWEBu/oFJJqph1jANhmz7 bfPaRKAh5vmnn1pSepFgeZ88ECHCgta2dtizat9IDs4jSIg5Jq/WIWzqoMPCmBYPsbnQ L383GN7d6BUHjAENJybQKowhIVL6wHn1CNaNF2ieJEmzto9jKtin1YYbTRN43CNClTAP tQkGdZzXv/C1TruT+w2xTst47g3Tv+EXDCaFmGJ63rrKNrtsFv2Bq9KRUH1WHLhEuScA S4Tw== X-Gm-Message-State: AOJu0YxEOBQLtX+qPZhXMLC18q+mMseAsVbGhkOLRWxCf0TQOqF+uOY3 ifbhmBBgt18RjGFuUYz4l2K40M/kKv4ynGIgo2ErDsLxjOEXKa5o X-Gm-Gg: ASbGnct8NS5V4uC535s49I3/YMZ+Oxk6SllNnkMCg2gBawcJRaSQegXZ6iEK7SfdrTh mYDGKUFEQaDQQAHqh8cJALoTRYkKdSWYNTmJRZeVbXarmGXz+v/ECGW1H7T72pvFLTLKEbpDnee wVpR6yeiDdm5VSU74o/YTBKb8k4c2nHWjd/akKzOu+f9tXcHjjkcMvEnH6MhWo5fL8qYGpWOmkf LfDMqFqrQqHxM6V1dgpXqTHZIA1e3xtlLHPMK2e7qYNLTxU2tAU9rCc35HjLSNjwoyy8NwMTd63 UlhILX/5fW6LkEymzKt373o3nT3S+Vn7Pm2pXYKsvhc1aaYiKCSHBmmyA+EvhI2YH3VugniT+Nf +JVzyEcBwZvKPBQcllmvrPA== X-Google-Smtp-Source: AGHT+IHqLbXyqiRT7NqdVR0dl3nIkYZjjIPNiMEIVJorXmR/8NVvApkiI/PklUZTydJafmArzkEHNg== X-Received: by 2002:a05:6000:2586:b0:391:3b11:d604 with SMTP id ffacd0b85a97d-3a09fdd83a4mr1364515f8f.54.1746295015375; Sat, 03 May 2025 10:56:55 -0700 (PDT) Received: from [192.168.0.211] (84.123.234.224.dyn.user.ono.com. [84.123.234.224]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a099ae82e4sm5468390f8f.58.2025.05.03.10.56.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 May 2025 10:56:54 -0700 (PDT) Message-ID: <8fc51cd7-115a-425a-828e-c99defb5afef@gmail.com> Date: Sat, 3 May 2025 19:56:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18909: Query creates millions of temporary files and stalls To: Sergey Koposov , "tgl@sss.pgh.pa.us" Cc: "pgsql-bugs@lists.postgresql.org" References: <18909-e5e1b702c9441b8a@postgresql.org> <2051617.1746223978@sss.pgh.pa.us> <5e98fba645682c40bf5f88ef858963ade9681956.camel@ed.ac.uk> <2177960.1746289626@sss.pgh.pa.us> <80bab58be182e80e73b5d5f71664ede9ce58f957.camel@ed.ac.uk> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: <80bab58be182e80e73b5d5f71664ede9ce58f957.camel@ed.ac.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/5/2025 18:52, Sergey Koposov wrote: > On Sat, 2025-05-03 at 12:27 -0400, Tom Lane wrote: >> Yeah, this confirms the idea that the hashtable has exploded into an >> unreasonable number of buckets and batches. I don't know why a >> parallel hash join would be more prone to do that than a non-parallel >> one, though. I'm hoping some of the folks who worked on PHJ will >> look at this. > Here're my memory settings > > shared_buffers = 32GB > work_mem = 1GB May you show statistics from the pg_statistic table on two columns: "d.objid" and "gaps1.original_ext_source_id"? At least stanullfrac, stadistinct, stawidth and MCV frequencies. Also, an EXPLAIN ANALYZE on this query, which successfully finished execution without parallel workers, might provide quick insights. -- regards, Andrei Lepikhov