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 1qt7Yb-00AvKX-C8 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Oct 2023 14:29:57 +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 1qt7YZ-004vqO-9q for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Oct 2023 14:29:55 +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 1qt7YY-004vqF-W8 for pgsql-hackers@lists.postgresql.org; Wed, 18 Oct 2023 14:29:55 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qt7YU-001NY2-OC for pgsql-hackers@lists.postgresql.org; Wed, 18 Oct 2023 14:29:54 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c4fdf94666so76600301fa.2 for ; Wed, 18 Oct 2023 07:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1697639389; x=1698244189; darn=lists.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=YPUSOx2PO/6E0Qmhv5giEhHcxuvJEbdxN6EY7ov+L3g=; b=Ttnv7X0ba/YbDSyaGmq7+m7axsoO4/+5V9Tefa9HhADVJpMohfArePjN80e1xQPa+M L18jLYny6GzT1n0CGrpPudBb1JrN0Qhx5qF41nGGX5ozvolaIdQLVwISQJ15yMPwbqNQ GVqUR92H1Rvvo2r0Kek3B66JN+FSxpKCyNn4Nk/PI8WcoFB+M+Z9agZ+TGZLXM+a2lI7 qpU8Dxku2g0Df4f2DksA0bcER/R9FXILttpSnxl0YIlQ2ewBDRGJ6jAUsWhCIAIAQ+QL qfU2P1wXImVnFH6G2Ep7vUOLzrek4PkeAIAJ6NvDr4OnidKePxZMAFXHNJtE+5+chE5P qyEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697639389; x=1698244189; 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=YPUSOx2PO/6E0Qmhv5giEhHcxuvJEbdxN6EY7ov+L3g=; b=mlx9e1jetQqOaNPQhUyB07Vhe57j4nU+wfrx88lw97n8qhmEi4KIVYqOFc2q8s5wKU cLkmdRGisCCCl2zD2H97SYn2Um7ivAbwIhPpMewgHTq3PmxTLsZj4QXFHxUc0DYsuTRf cokNea4sTgKO7mCT8eTxrUmiK5MtN+JQf8zotpzt5Z1TRBY4OIeh+bIgZMnENJqdJMac GkK4TB745rtVtNB4c19Lp8AU20rj6TOTrJ8+QSxl7o38cTLqj+bAWUi+PsLW4efhJoZS oxh4ERTTCNWt84UoPPxA45i5GEnQ0Ux0nrQYCy64oOrIRQqiuid6FN09eY6xbfd3Sxg6 pQwQ== X-Gm-Message-State: AOJu0Yz5Loxs8lozmqerA0lmZ5IzSTC8tRnJTTHgJspvlOyUozRi8PE1 UXWMldVr5WjAPLgrJFy7ipsBBQ== X-Google-Smtp-Source: AGHT+IE0thtkB+bZhamZQKu5b9L9VTFbaEtvN0ujb+VmaJ5iUAOO1WHh0rU3Br8W3zKpPUiDccWyPg== X-Received: by 2002:a2e:9f16:0:b0:2bf:f32a:1f64 with SMTP id u22-20020a2e9f16000000b002bff32a1f64mr4532765ljk.18.1697639389366; Wed, 18 Oct 2023 07:29:49 -0700 (PDT) Received: from [10.137.0.17] (srv1.mobissw.com. [89.235.0.226]) by smtp.gmail.com with ESMTPSA id i42-20020a05600c4b2a00b00406408dc788sm1782856wmp.44.2023.10.18.07.29.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Oct 2023 07:29:49 -0700 (PDT) Message-ID: <21465bdd-5b6d-6071-aa89-ce77e6f3cdb1@enterprisedb.com> Date: Wed, 18 Oct 2023 16:29:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: BRIN minmax multi - incorrect distance for infinite timestamp/date Content-Language: en-US To: Dean Rasheed Cc: Ashutosh Bapat , PostgreSQL Hackers References: <14c205c6-fbf4-d2f2-3ea8-a7d5c5d63180@enterprisedb.com> <75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com> <31400145-6f71-a6b2-e371-048a8e1584ef@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/18/23 12:13, Dean Rasheed wrote: > On Tue, 17 Oct 2023 at 21:25, Tomas Vondra > wrote: >> >> Here's a couple cleaned-up patches fixing the various discussed here. >> I've tried to always add a regression test demonstrating the issue >> first, and then fix it in the next patch. >> > > This looks good to me. > >> 2) incorrect subtraction in distance for date values (0003) >> >> All the problems except "2" have been discussed earlier, but this seems >> a bit more serious than the other issues, as it's easier to hit. It >> subtracts the values in the opposite order (smaller - larger), so the >> distances are negated. Which means we actually merge the values from the >> most distant ones, and thus are "guaranteed" to build very a very >> inefficient summary. >> > > Yeah, that's not good. Amusingly this accidentally made infinite dates > behave correctly, since they were distance 0 away from anything else, > which was larger than all the other negative distances! But yes, that > needed fixing properly. > Right. Apparently two wrongs can make a right, after all ;-) regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company