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 1rfTBc-000L4W-Ke for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Feb 2024 23:18:05 +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 1rfTBa-00FwJ2-70 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Feb 2024 23:18:02 +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 1rfTBZ-00FwIt-T9 for pgsql-hackers@lists.postgresql.org; Wed, 28 Feb 2024 23:18:02 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rfTBS-001twx-Cj for pgsql-hackers@postgresql.org; Wed, 28 Feb 2024 23:18:01 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-55a5e7fa471so529229a12.1 for ; Wed, 28 Feb 2024 15:17:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1709162273; x=1709767073; darn=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=RsZe2VOgVePo58CuvEWyCbHZVNrohKId39Ef2kzwdeY=; b=Ix5lCzx0p0ZZN7mG4GZBYMs7HTWAg5pom7/pusvF1G9RQ08xk6UgeaACjdFDXSPGML mQD6Ygw24u6IPKHG7Vp5UIJT0Kw6QqLe3SVmgJ/3L1L5zoLBOaQBZ5wTkpjYzw+BAMw6 lcmZ+vLuThyIlTPE7peU7FPkgSescpePOSY+Dwbn7m6tWzv3wCv8JMjnTWsdbxV67PMU FjJLNm+n2eaYzltDcvCvX4NpB/aNU17cfX+3niSER2Ts/v/063Yl1BRjQpSy4qc7Se2u xw3wGOwmPwo2qpcLrGYULh119F1eBpT5h3oJNBG97clorybibZRVAdRSRE402nkdMkdo SWFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709162273; x=1709767073; 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=RsZe2VOgVePo58CuvEWyCbHZVNrohKId39Ef2kzwdeY=; b=qXhQWLYv3ysJIbChFTshlmp55hVQ7D3u9U9K7uuG7tmArEkIa8KOVeA1GYw8hKKRul lQx4ujuM/wUEYLnp+m16GGMI7rhOdP+q9b4ZPvjygdBGOgVpxWz/VpOCHPs2ECjTCEO/ HOg2u7cqJNaceJt41u3jWT+4ubkMGSuiV33VO+WhA2jLnj7vbp2ioSMHFjPT4axgjibi GWFsyB4zWJJLrg+zIP+Cs7k8V6nmCRv8lu9CIoxvalKr3XEH0uyWwK+5Cor0YE+TUioz 6Bv72HndGyjC072htUGbepg6ilHw5ppdb6sfEz+zPH7TYmW0P/g3GLjDqcLtfT0YsFlK OyFA== X-Forwarded-Encrypted: i=1; AJvYcCUKZT1GueSlnp1fSdMH73WZImYL9mvG0g3mltRAx38AnKrV36dUsr242xKkv/jkOzJxk+wwoDcoH8vn0m3NH/VkQeRJ7Xo+cMko0+lU X-Gm-Message-State: AOJu0YzYp1AyGk8TkgK7pEWvg7dE+Y+eounBhdj8tlRND+wJczcByfxS OXTMRjwMiId6qVj1MpD6pYs5J01moDZxkXdD1tBh5bZkcjM4vhtWGVE/TRb7kw== X-Google-Smtp-Source: AGHT+IEw+EZ7wOVSZVOqwyYQAub3BsjyqL/rhdxxiaPDREL0aeazUwV24DR/eF6W6hd+siVj6jPlPw== X-Received: by 2002:a50:cc08:0:b0:565:7733:3c58 with SMTP id m8-20020a50cc08000000b0056577333c58mr242061edi.4.1709162273096; Wed, 28 Feb 2024 15:17:53 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-226-138.bb.vodafone.cz. [86.49.226.138]) by smtp.gmail.com with ESMTPSA id s12-20020a056402520c00b0056691924615sm17948edd.2.2024.02.28.15.17.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Feb 2024 15:17:52 -0800 (PST) Message-ID: <45bed4f3-a5bf-4a34-b544-7e751bd437e1@enterprisedb.com> Date: Thu, 29 Feb 2024 00:17:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BitmapHeapScan streaming read user and prelim refactoring To: Melanie Plageman Cc: Andres Freund , Pg Hackers , Thomas Munro , Heikki Linnakangas , Nazir Bilal Yavuz References: <20240214194228.jf4o7luxtyra5ggv@awork3.anarazel.de> <20240216173559.xiy5xcl5dqmsprns@liskov> <20240227015028.knohvy3spaqwk7lf@liskov> <20240227142230.nu3ytvcjwouvczlt@liskov> <40c213cc-6a15-4e2c-9e56-dae344d52a73@enterprisedb.com> <4b751bc5-446f-4357-a1e1-827585bf22b0@enterprisedb.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/28/24 21:06, Melanie Plageman wrote: > On Wed, Feb 28, 2024 at 2:23 PM Tomas Vondra > wrote: >> >> On 2/28/24 15:56, Tomas Vondra wrote: >>>> ... >>> >>> Sure, I can do that. It'll take a couple hours to get the results, I'll >>> share them when I have them. >>> >> >> Here are the results with only patches 0001 - 0012 applied (i.e. without >> the patch introducing the streaming read API, and the patch switching >> the bitmap heap scan to use it). >> >> The changes in performance don't disappear entirely, but the scale is >> certainly much smaller - both in the complete results for all runs, and >> for the "optimal" runs that would actually pick bitmapscan. > > Hmm. I'm trying to think how my refactor could have had this impact. > It seems like all the most notable regressions are with 4 parallel > workers. What do the numeric column labels mean across the top > (2,4,8,16...) -- are they related to "matches"? And if so, what does > that mean? > That's the number of distinct values matched by the query, which should be an approximation of the number of matching rows. The number of distinct values in the data set differs by data set, but for 1M rows it's roughly like this: uniform: 10k linear: 10k cyclic: 100 So for example matches=128 means ~1% of rows for uniform/linear, and 100% for cyclic data sets. As for the possible cause, I think it's clear most of the difference comes from the last patch that actually switches bitmap heap scan to the streaming read API. That's mostly expected/understandable, although we probably need to look into the regressions or cases with e_i_c=0. To analyze the 0001-0012 patches, maybe it'd be helpful to run tests for individual patches. I can try doing that tomorrow. It'll have to be a limited set of tests, to reduce the time, but might tell us whether it's due to a single patch or multiple patches. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company