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 1qrH6q-003TjM-P2 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Oct 2023 12:17:40 +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 1qrH6o-0007wu-F9 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Oct 2023 12:17:39 +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 1qrH6o-0007tS-4b for pgsql-hackers@lists.postgresql.org; Fri, 13 Oct 2023 12:17:38 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qrH6j-000LL3-N9 for pgsql-hackers@lists.postgresql.org; Fri, 13 Oct 2023 12:17:37 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40675f06f1fso20309425e9.1 for ; Fri, 13 Oct 2023 05:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1697199451; x=1697804251; 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=FfV/dcv7UTSDAz2zkcgwfUz4S+Zqk9Rkhof4coCDeCM=; b=mAFAKou811XWPptNMrVRT7yvOeStqj7nDTXF6dyBVxEWeeNdlZ91B/5YhixyKny1yt wlDHaDD5Cw6vV8GqOnJjdCR4UJuqwwDPpmO2NDB+sWzHU/6jUbFp/RJRXPNcI3ldbtQY E8vyANH7EXc6djbUuiG9nb3Fm582zBYaNLFsqcuqsyBdjvqazIAcvye+DoBJwSOHcnuG Oyx8H4/rkgFkyabmihQ038AHLcl9/tr3IWIqNr395FsqRPT+wgtgUUa/qI98ftvRSJHK UHKVhEqv0aNorz1TFMsnfEnGT6v14Kb4dPQ6LfbCtjcD01DkJxqxpZO6FnDHjYOTki0K WGaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697199451; x=1697804251; 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=FfV/dcv7UTSDAz2zkcgwfUz4S+Zqk9Rkhof4coCDeCM=; b=YBF4xLXf+kDbFpBGHFZjZ5vd3+9rIbHmMmWDyFCYyVTF8rkhmat/4zIX72iacQvT8V 2UAI5VHDvNvP9/xHLm3HPd4WsVxy5bISDftVs+L/XGt/Vd0kkQf4twVKNjl/bRHPN7jn vGcxwOWJZL5ngtdBqh28RYWnk29p6vTf7j8CR0uHDyzn7u5ilKA1OiYpqwu2/ziz2afo ZYG9vXKgBE4K+t4dn5DvW/5f10Dyc16vJIopIwYFj6BObJLhKtYp2lHLKDrO28EcTzDP anp5qyshxVzv8fguUhd+7+JcVGGJpoOIJc0d7slwuFGZZclmrz9exT78bDpdPQbBCXcn /S6Q== X-Gm-Message-State: AOJu0Yy5W1hGNcRjule3Oq/bqPmTAl65TJ22fMqJOhEO/cmGnb5Hmggm Z3xjLxcZeNM8eUEYkuObRGf8kg== X-Google-Smtp-Source: AGHT+IHOgTPQEZmeunKT0i6IqI5GD59yu1sBXf1wrITwo11NdQwL5W5UL2rxvS6kpElfnxtTSvsYUQ== X-Received: by 2002:adf:b1d7:0:b0:32d:9a1f:479d with SMTP id r23-20020adfb1d7000000b0032d9a1f479dmr1218823wra.23.1697199451590; Fri, 13 Oct 2023 05:17:31 -0700 (PDT) Received: from [10.137.0.17] (srv1.mobissw.com. [89.235.0.226]) by smtp.gmail.com with ESMTPSA id f4-20020a5d4dc4000000b003253523d767sm4220542wru.109.2023.10.13.05.17.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Oct 2023 05:17:31 -0700 (PDT) Message-ID: <75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com> Date: Fri, 13 Oct 2023 14:17:30 +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: PostgreSQL Hackers , Ashutosh Bapat References: <14c205c6-fbf4-d2f2-3ea8-a7d5c5d63180@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/13/23 14:04, Dean Rasheed wrote: > On Fri, 13 Oct 2023 at 11:44, Tomas Vondra > wrote: >> >> On 10/13/23 11:21, Dean Rasheed wrote: >>> >>> Is this only inefficient? Or can it also lead to wrong query results? >> >> I don't think it can produce incorrect results. It only affects which >> values we "merge" into an interval when building the summaries. >> > > Ah, I get it now. These "distance" support functions are only used to > see how far apart 2 ranges are, for the purposes of the algorithm that > merges the 2 closest ranges. So if it gets it wrong, it only leads to > a poor choice of ranges to merge, making the query inefficient, but > still correct. > Right. > Presumably, that also makes this kind of change safe to back-patch > (not sure if you were planning to do that?), since it will only affect > range merging choices when inserting new values into existing indexes. > I do plan to backpatch this, yes. I don't think there are many people affected by this (few people are using infinite dates/timestamps, but maybe the overflow could be more common). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company