Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ok4Pb-0005jt-Hf for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Oct 2022 14:14:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ok4PZ-0003i7-M4 for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Oct 2022 14:14:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ok4PZ-0003hy-Cs for pgsql-hackers@lists.postgresql.org; Sun, 16 Oct 2022 14:14:41 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ok4PS-0004Um-FJ for pgsql-hackers@lists.postgresql.org; Sun, 16 Oct 2022 14:14:40 +0000 Received: by mail-ed1-x52f.google.com with SMTP id a67so12699443edf.12 for ; Sun, 16 Oct 2022 07:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; 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=SRni2FjuLal5iZ/VsmUl9SX0RdJjjAgbCBXgk2i0dD0=; b=Noc80f+6CRnH92HO8utvy7EMm9NpmDWbo7lD5TChE1Wn9AiIcAcqd3x+64YlCJDPMc tWpodTg1LsIZrNlokSv9gAqfDR/j1Y7y8cBscrZc5tePlNOqfgkSJgZpW/B7VjmzZYAa GNgq5/SubAyhX6hvxJ6vViTIhfCMcMAF4xbldmUXjg6a34lgJ2puU84MCmmrtldg54SM tejeEL53NwqbH9e7p0QKhOCml44hxt8ytNqwULjrum+GyAkwx+5TznU+q3Lt2nAGZMhP J7rtjD3qMIyWBkeHNHSf7kz8XRp0bF4j8iDtBd8u2Wg65HSh6nfs7vq0hquH/IA4nnx5 Xgqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=SRni2FjuLal5iZ/VsmUl9SX0RdJjjAgbCBXgk2i0dD0=; b=wcJzW5FYiZkMfNRn8sMPns2i84eKtc4wtYGkGROgyM50s9z/ZluD/tR8iXIph6Fj3e HnPTPKBg70NzzOFXXwwhwlJfJYHFUI2lA/0M4Zi30ylFnb4Ms+pYZ/qNt/VOJsoDv8e6 slCq3pGUIgJSpAgZ+hjz2vqH9eUsO0szcT0el5QhNT/hyXYLEqZ/BGFzvQHYoOBzdiAF wRYZ55l32v5c2cjzaM6xbbw+N5bkybJW4Dtx1rAuKop/AqyURl47OF5ZAmnrsmL8PNI7 IOkptJCI3APwlrL3xKqtMmzCcl0ka1verqphqI+dk2Sdeme8u7velESdu6SYmNuhMc2J yO/g== X-Gm-Message-State: ACrzQf3xAiYEx0KiMNlot0kxcWxtoCNG+RN3qjfkpkQQxhwStEbs9+C3 1Wp76ONxZyWAEju6WXQUodPHw6grXZwM8yW/FiSQxgbYUNtfeyrDWbpSmj5JEvAnlW5m4mZ1RPB Al5i8kVPqJJXbwaWMNGZYmYbxZUiqviwrMF/40i3s+toB3N9EQ3UWJpfzP4bN9/lAod9iPap9DO Y8gBUprsM9Gsj8nj70DICsrFENIXlpbATHoAlZAoAiAT7L84A0KDjszSy1h4IfzZquh8gbFL+30 ue2FMKlhfy2Gbmmr8MAx4sBnWSVcVFBBhh2fG25S2AI/aWBFn75Q8veDJD0 X-Google-Smtp-Source: AMsMyM5dx/cDyqQ/pnh4Zyqe0PVHxTkr1YVvO2WJEDJ4ZGh3OfOPfgDG3Wcs64sVPzLCTpMrRBvF1g== X-Received: by 2002:a05:6402:5419:b0:457:c955:a40f with SMTP id ev25-20020a056402541900b00457c955a40fmr6139589edb.391.1665929673286; Sun, 16 Oct 2022 07:14:33 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-228-162.bb.vodafone.cz. [86.49.228.162]) by smtp.gmail.com with ESMTPSA id ky23-20020a170907779700b0078a86e013c4sm4688294ejc.61.2022.10.16.07.14.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Oct 2022 07:14:32 -0700 (PDT) Message-ID: <3b7f45c8-5b95-7c74-13cf-a58cb44c1de1@enterprisedb.com> Date: Sun, 16 Oct 2022 16:14:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: PATCH: Using BRIN indexes for sorted output Content-Language: en-US To: Zhihong Yu Cc: PostgreSQL Hackers References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/16/22 03:36, Zhihong Yu wrote: > > > On Sat, Oct 15, 2022 at 8:23 AM Tomas Vondra > > > wrote: > > On 10/15/22 15:46, Zhihong Yu wrote: > >... > >     8) Parallel version is not supported, but I think it shouldn't be > >     possible. Just make the leader build the range info, and then > let the > >     workers to acquire/sort ranges and merge them by Gather Merge. > > ... > > Hi, > > I am still going over the patch. > > > > Minor: for #8, I guess you meant `it should be possible` . > > > > Yes, I meant to say it should be possible. Sorry for the confusion. > > > > regards > > -- > Tomas Vondra > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > Hi, > > For brin_minmax_ranges, looking at the assignment to gottuple and > reading gottuple, it seems variable gottuple can be omitted - we can > check tup directly. > > +   /* Maybe mark the range as processed. */ > +   range->processed |= mark_processed; > > `Maybe` can be dropped. > No, because the "mark_processed" may be false. So we may not mark it as processed in some cases. > For brinsort_load_tuples(), do we need to check for interrupts inside > the loop ? > Similar question for subsequent methods involving loops, such > as brinsort_load_unsummarized_ranges. > We could/should, although most of the loops should be very short. regrds -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company