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 1sQc85-00AjAU-PP for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2024 00:21:17 +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 1sQc75-00GdFs-0V for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2024 00:20:15 +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 1sQc74-00GdDv-Ma for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2024 00:20:14 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sQc72-000xNB-5u for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2024 00:20:13 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2ebe40673e8so44583191fa.3 for ; Sun, 07 Jul 2024 17:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720398010; x=1721002810; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QvMxMp612ri247cED4obkZkNdmBrw/5d15pQFnc1boA=; b=FbxDmGMhdBh4tH3rKMpW9Gc2xu1XmcXjmAVxaDRE4z1n/9j0qEx2mnPwzpsJ0QVTQm ZTsx2rpGcvHrmVwzM61MqngsaoKAuCTcOstYChZt5VPBfFYJjNynGsF+EAQnDZodXmVY /AYW8MCUK8gOhEUZE3U09pbMTLr58hacnQkyfYQ4TtUGXOwofS5uDByX33PfJFQKspq0 q9d4sXstzPhFgl9wr/qZI8Ax6vGIhu0juzsl9wSB//Yd5hLu9B+azj4SIWCo4qfxqEuK YkFw2TeF7+5K04KTldnFRtXTzshmmKflgcKmMkls/EiUtCOHwFEZouYkV8bZeG1p6kF7 QHng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720398010; x=1721002810; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QvMxMp612ri247cED4obkZkNdmBrw/5d15pQFnc1boA=; b=PqWIHb9NzCC8APz+NhEbk/dy+40bMoijjc9cJW3z1MaxXhcCltymj+bpXxluunBtWM QmDXu0JJe9zutFRiYPv4d2LWI5/SJ7Ql7uoKMdpeW1hkEqU1sHfI9jpx8ApfCjJKr0q8 l+Hi1+ZwRlsWToPbwFJdL1q9j4enSONtpz2OOAkLCYOKiTKsh9SM8yENCKsDhMgsQb8R AUFXiKfXIh6T4nDLB3jT5gB5wZfhVCQjm7+FOUe8kkLSPtkMtG2j/PFt21BSphPIdwaK wgbd6zSWqK8z0MehO9bl9nzwvE0CX4SkXwbg3BCnBYg2/j+W8hl3fUQ/ynObbSaNNeSS oalw== X-Forwarded-Encrypted: i=1; AJvYcCUkykAZ67gKI4l3cVbOFbYEWuiv6Z1I029urCn7Cg0Oa3GVALMuG++pvVvHidvYLdPmMivKX9OEoLBSdgaRtkSZq7xVX4xPyMJ2tRVIOL5dUHhC X-Gm-Message-State: AOJu0Yz9/P8EyxsFCzq1ld9Zeapxe7S3suHq6MUr8LAKKezU3VIKEXDo C/MB65vicdxeNRR4Wz/UgimrM/oM/gEb6/KLjrthjHu7PxHGfFp2OKJKe4s60UNsJJPQn+8gAtm d8Q/z+oA+lBSl+AR5WGAJ8ktyU7U= X-Google-Smtp-Source: AGHT+IGUxdAjoFlJH2QoMVAkzoWhSb3JC8WFdGHUXbs4ULSIMcurcHJndNkmGuIU61Utk3rDrmQTKBpdR5qsQmjuMz0= X-Received: by 2002:a2e:8889:0:b0:2ee:7590:7ce5 with SMTP id 38308e7fff4ca-2ee8ed66ea8mr62637791fa.3.1720398010290; Sun, 07 Jul 2024 17:20:10 -0700 (PDT) MIME-Version: 1.0 References: <13bd913f-94b6-43cf-b849-4d762e5297d8@yandex.ru> In-Reply-To: From: David Rowley Date: Mon, 8 Jul 2024 12:19:58 +1200 Message-ID: Subject: Re: Parallel Bitmap Heap Scan reports per-worker stats in EXPLAIN ANALYZE To: Masahiro.Ikeda@nttdata.com Cc: lena.ribackina@yandex.ru, donghanglin@gmail.com, geidav.pg@gmail.com, melanieplageman@gmail.com, tomas.vondra@enterprisedb.com, dilipbalaut@gmail.com, pgsql-hackers@lists.postgresql.org, hlinnaka@iki.fi Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 5 Jul 2024 at 12:52, David Rowley wrote: > I propose we change these to uint64 while causing churn in this area, > probably as a follow-on patch. I think a uint32 isn't wide enough as > you could exceed the limit with rescans. I wondered how large a query it would take to cause this problem. I tried: create table a (a int); insert into a select x%1000 from generate_Series(1,1500000)x; create index on a(a); vacuum freeze analyze a; set enable_hashjoin=0; set enable_mergejoin=0; set enable_indexscan=0; set max_parallel_workers_per_gather=0; explain (analyze, costs off, timing off, summary off) select count(*) from a a1 inner join a a2 on a1.a=a2.a; After about 15 mins, the trimmed output from Linux is: Aggregate (actual rows=1 loops=1) -> Nested Loop (actual rows=2250000000 loops=1) -> Seq Scan on a a1 (actual rows=1500000 loops=1) -> Bitmap Heap Scan on a a2 (actual rows=1500 loops=1500000) Recheck Cond: (a1.a = a) Heap Blocks: exact=2250000000 -> Bitmap Index Scan on a_a_idx (actual rows=1500 loops=1500000) Index Cond: (a = a1.a) Whereas, on MSVC, due to sizeof(long) == 4, it's: Aggregate (actual rows=1 loops=1) -> Nested Loop (actual rows=2250000000 loops=1) -> Seq Scan on a a1 (actual rows=1500000 loops=1) -> Bitmap Heap Scan on a a2 (actual rows=1500 loops=1500000) Recheck Cond: (a1.a = a) -> Bitmap Index Scan on a_a_idx (actual rows=1500 loops=1500000) Index Cond: (a = a1.a) Notice the "Heap Blocks: exact=2250000000" is missing on Windows. This is because it wrapped around to a negative value and show_tidbitmap_info() only shows > 0 values. I feel this is a good enough justification to increase the width of those counters to uint64, so I'll do that too. David