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 1rgY2l-006iZD-UY for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Mar 2024 22:41:24 +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 1rgY2k-00HItT-KE for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Mar 2024 22:41:23 +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 1rgY2k-00HItK-9s for pgsql-hackers@lists.postgresql.org; Sat, 02 Mar 2024 22:41:22 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rgY2g-002Y90-2M for pgsql-hackers@postgresql.org; Sat, 02 Mar 2024 22:41:20 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a3fb8b0b7acso459705366b.2 for ; Sat, 02 Mar 2024 14:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1709419276; x=1710024076; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dg6Ho7pUOUEz+ZBR77r23V2s5j+aWQ11esoFYedMMbM=; b=VeCE3KqRs9ncfnS9v86+WvPNT62TfPGRhKY9B50/DpH/0YxP0F3nJHmMguoT8pYX4t UwuNOlElKyQH6m042X9j90Kts15uLbooOfpeJm+oKVZY1WBtLRyV7HA3TFlRvtHN9PZT cJxjFNeL5dzM0wmFshzVZIQOTEIUHATfePsKGkZwXK4GN1Y6edyl6EbGeaXiZrxSYmZl /Mm+IXsskzOqFChmoobVXTNNJVHT7RV6Y/2G3SSLJkPqKJJdStsBJh1SV7yn8yxZLf89 dI08OK+j5umbT3MEKRTF7/REtJ1aGeTbgdXgD3ieTmSrd6lzvspDy2amMkNFDiNoBe9U u/Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709419276; x=1710024076; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dg6Ho7pUOUEz+ZBR77r23V2s5j+aWQ11esoFYedMMbM=; b=LCngPGGQbM+drUvDuthsxmEvEG5NWmWRJ0bD0TowzIChR+7ERu6XfHjDyJeEIIOymd O2kj1Y80xndmv1VazIJZqwFra7i6uVzzx4nNJJpel0f8Q3azkusUyQRlhao+t2tLwOkB vT94+Ba+1jQitVCeCdQl+HTokudAutDP1NdBmj9axiZToNG7t7aBymIkCrC7q0DJmvLr Ix0/yTLhjjPYIhUZaEGoPNbice9EUbG/96exLP17GFvkYba+nuR/W7zangXDmCg6O0Tj zTRXNPk2jQRrQ6CJWg9e7Nui/hSqdeMLn8t/w1fCODG++bnqNsAnvA7JRlg9CiFMb76w M/JA== X-Forwarded-Encrypted: i=1; AJvYcCUU58v27BcXehA+DYCz6lc43E0Rl+CFwrZpH6SDLDjVoUR1kBZr61lwxOJirGzU+Igne9sWgL+SV4yT4+OTNpAE52S+tXkM+tqqSkIh X-Gm-Message-State: AOJu0YwW7Qov+jKtLNQirOO803YiwtrACMabsJVEaMa6Slbd7dHoM5xa M8fcWO9ZURqjsBX5qFvRdEYztuj2Ydn8A90rcxQIQOID8Cso2OlE0wZyOFTcQg== X-Google-Smtp-Source: AGHT+IFEuMLvdktI31QAcnvau1I5MiqmFnGwndMc2MWUG48g/GHMqMavsDd9FWmCZo9flCoowFu0Rg== X-Received: by 2002:a17:906:255a:b0:a3f:b5d1:7174 with SMTP id j26-20020a170906255a00b00a3fb5d17174mr3895000ejb.3.1709419276171; Sat, 02 Mar 2024 14:41:16 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id n26-20020a170906119a00b00a438d594d3esm3106975eja.217.2024.03.02.14.41.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Mar 2024 14:41:15 -0800 (PST) Message-ID: <4f9bab17-baec-4e32-9751-b19206c55373@enterprisedb.com> Date: Sat, 2 Mar 2024 23:41:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BitmapHeapScan streaming read user and prelim refactoring Content-Language: en-US To: Melanie Plageman Cc: Andres Freund , Pg Hackers , Thomas Munro , Heikki Linnakangas , Nazir Bilal Yavuz References: <4b751bc5-446f-4357-a1e1-827585bf22b0@enterprisedb.com> <45bed4f3-a5bf-4a34-b544-7e751bd437e1@enterprisedb.com> <91090d58-7d3f-4447-9425-f24ba66e292a@enterprisedb.com> <8de6f6d7-9b9d-47a4-98cc-84bf31a314db@enterprisedb.com> <35bdb7db-7412-4d18-9b06-fea5fcea37bc@enterprisedb.com> <0c7c0673-d012-41d1-8e76-31cc4a1b1eec@enterprisedb.com> <410c42e0-f17b-447f-aa48-fba052d5c080@enterprisedb.com> <186bcba1-a0e1-4871-8ed2-0d301901d0ba@enterprisedb.com> 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 3/2/24 23:28, Melanie Plageman wrote: > On Sat, Mar 2, 2024 at 10:05 AM Tomas Vondra > wrote: >> >> Here's a PDF with charts for a dataset where the row selectivity is more >> correlated to selectivity of pages. I'm attaching the updated script, >> with the SQL generating the data set. But the short story is all rows on >> a single page have the same random value, so the selectivity of rows and >> pages should be the same. >> >> The first page has results for the original "uniform", the second page >> is the new "uniform-pages" data set. There are 4 charts, for >> master/patched and 0/4 parallel workers. Overall the behavior is the >> same, but for the "uniform-pages" it's much more gradual (with respect >> to row selectivity). I think that's expected. > > Cool! Thanks for doing this. I have convinced myself that Thomas' > forthcoming patch which will eliminate prefetching with eic = 0 will > fix the eic 0 blue line regressions. The eic = 1 with four parallel > workers is more confusing. And it seems more noticeably bad with your > randomized-pages dataset. > > Regarding your earlier question: > >> Just to be sure we're on the same page regarding what eic=1 means, >> consider a simple sequence of pages: A, B, C, D, E, ... >> >> With the current "master" code, eic=1 means we'll issue a prefetch for B >> and then read+process A. And then issue prefetch for C and read+process >> B, and so on. It's always one page ahead. > > Yes, that is what I mean for eic = 1 > >> As for how this is related to eic=1 - I think my point was that these >> are "adversary" data sets, most likely to show regressions. This applies >> especially to the "uniform" data set, because as the row selectivity >> grows, it's more and more likely it's right after to the current one, >> and so a read-ahead would likely do the trick. > > No, I think you're right that eic=1 should prefetch. As you say, with > high selectivity, a bitmap plan is likely not the best one anyway, so > not prefetching in order to preserve the performance of those cases > seems silly. > I was just trying to respond do this from an earlier message: > Yes, I would like to see results from a data set where selectivity is > more correlated to pages/heap fetches. But, I'm not sure I see how > that is related to prefetching when eic = 1. And in that same message you also said "Not doing prefetching with eic 1 actually seems like the right behavior". Hence my argument we should not stop prefetching for eic=1. But maybe I'm confused - it seems agree eic=1 should prefetch, and that uniform data set may not be a good argument against that. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company