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 1uzHno-001nEZ-Ha for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 16:48:12 +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 1uzHnm-000bDy-VK for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 16:48:10 +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 1uzHnm-000bDq-LG for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 16:48:10 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uzHnk-0017YH-20 for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 16:48:09 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-25669596955so11012935ad.0 for ; Thu, 18 Sep 2025 09:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758214087; x=1758818887; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MgmObtckbGSrCPEip+zDqIw4gzUeXYDWsQnmqgq5luw=; b=S1DzC+9+uX+xROYGOFKDIYvCcimnBjEUi4BuTeG+9mralmbtzLjCMdOQuSXb7GkPeX V/vLpvF2m2QoGJJDIGDsOeSQSeHpXz9iK+6GnP6p41/ubhfpFghDRpbUdWefcyL2U/eO NjDtOvckChfp6Rlm0L7icQGMDYvolmQCk6cJ3vtCtDUhwCJvonoykwB2bk5KLMt+xIKW V8rHL53LsG2qajCWmyz7yjAr9Ks8jmXVB6fSHPFwErsy7afbFM4i3IWbef45rZuFmf0X J1TI59ztslzv4J5+lKn1k9Bq4ipgGOSn6XNtGuJYkbYOLsGzaV/k2rMxcS/g5bWBdRsU fRBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758214087; x=1758818887; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MgmObtckbGSrCPEip+zDqIw4gzUeXYDWsQnmqgq5luw=; b=eIvRyB0kxJjkj0YufHGa6VkAA8Grt0TCldG5gE3lqE86JeRL/JRhr0Hcd64z52KYEs 49XlLorFVegjxM6LB+jmx+aY4aJjpPGLOy4LAooLGIrpCVZNkhTwm3WbjtFJOgWnsGkI Wu4pDb3UuxfpB9JwAHVH19DrM6+/pz9vts0Kpv2X0NPYEP704gHAjqh/hkHZKxU8hzw/ mTiDigGU4pFe3gV52fci+cOgtVe6Hg/SpgBx+0aAGPzmY1ZbNe9zf54YxoXyAcZUiPMS a6Tj1etPn96lB11arSTTgOZ+uAw5nLIyArjbtBjY5KNrpfJw/++mst19RJe4SEZ7Gw0Z FN5g== X-Forwarded-Encrypted: i=1; AJvYcCU832jqaxw74zcHw47kXDVynvtSdYzo03PGkVPwP4b/omgTIm9MfADsvGtoJQlgLas7O3HI7pdBYB2gCWQ5cFmTSg==@lists.postgresql.org X-Gm-Message-State: AOJu0Ywdqd4EJtR+7TZsODQmaxR5DLLVpCBxwv6WX/Km1vXgUhtVqorV gbFFI0lW/lMsVR6jkTyMBA+CwUUNetWToh7SoORvE1pRQwEs3f1Ui6alh4mSlqWtYjLtm8tyZTt UkMKCw/pUW8Xj8Y8qW6+QBPRVfF4O6eY= X-Gm-Gg: ASbGncvNLiYDj/njH6znOQ4QNeBX4AogMqZ7JOaVLVo2WYdXq2pv6wQ4CUqN0r+D2Se VbPmB9QJ+ffJWM8FVs0QFLck4T4lxuK0eqkhPtEKoKyE06F9JpjRdf5a8oTzuWuT70yKYVbLvEb J4PS8gxViQGe9e/kG+HvhI0TOD09kknuQi89bkYIN9UA8ZWq6ZJ5PnV79DBRg7Dv+4NGuARO4mj Z8glXCYe0awKZRghmQ4/qQQTQ== X-Google-Smtp-Source: AGHT+IFnnPrP7zqo+Mx/sSml+nQ2ZSN5VRBur0jzPw+p750Hk66auhhZNbJ52T+FdNisRBsveZeXKAYjLwqfXxaUuLQ= X-Received: by 2002:a17:903:2f83:b0:265:bb0:cbc with SMTP id d9443c01a7336-269ba559260mr2660635ad.47.1758214087365; Thu, 18 Sep 2025 09:48:07 -0700 (PDT) MIME-Version: 1.0 References: <1507576.1758120083@sss.pgh.pa.us> <62133334-b844-4d0b-b248-1a8446757e5f@dalibo.com> <1916727.1758209549@sss.pgh.pa.us> <1972974.1758213639@sss.pgh.pa.us> In-Reply-To: <1972974.1758213639@sss.pgh.pa.us> From: Ranier Vilela Date: Thu, 18 Sep 2025 13:48:08 -0300 X-Gm-Features: AS18NWB2mYF8KFGPp2LgI-eT6GARwvtSjLLelfjNfU331SnM0k1YjiaUpSo27Cs Message-ID: Subject: Re: Indexes on expressions with multiple columns and operators To: Tom Lane Cc: =?UTF-8?B?RnLDqWTDqXJpYyBZaHVlbA==?= , "pgsql-performance@lists.postgresql.org" , Jehan-Guillaume de Rorthais , Christophe Courtois , Laurenz Albe Content-Type: multipart/alternative; boundary="0000000000001dd884063f161e44" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001dd884063f161e44 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Em qui., 18 de set. de 2025 =C3=A0s 13:40, Tom Lane esc= reveu: > I wrote: > > Sigh ... so the answer is this used to work (since commit 39df0f150) > > and then I carelessly broke it in commit a391ff3c3. If you try this > > test case in versions 9.5..11 you get a spot-on rowcount estimate. > > Serves me right for not having a test case I guess, but I'm astonished > > that nobody complained sooner. > > The attached fixes things so it works like it did pre-a391ff3c3. > > I spent some time trying to devise a test case, and was reminded > of why I didn't have one before: it's hard to make a case that > will be robust enough to not show diffs in the buildfarm. > I'll keep thinking about that though. > One question, make difference return -1.0 (float point notation)? If not, static analyzers will have less work. best regards, Ranier Vilela --0000000000001dd884063f161e44 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Em qui., 18 de = set. de 2025 =C3=A0s 13:40, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
I wrote:
> Sigh ... so the answer is this used to work (since commit 39df0f150) > and then I carelessly broke it in commit a391ff3c3.=C2=A0 If you try t= his
> test case in versions 9.5..11 you get a spot-on rowcount estimate.
> Serves me right for not having a test case I guess, but I'm astoni= shed
> that nobody complained sooner.

The attached fixes things so it works like it did pre-a391ff3c3.

I spent some time trying to devise a test case, and was reminded
of why I didn't have one before: it's hard to make a case that
will be robust enough to not show diffs in the buildfarm.
I'll keep thinking about that though.
One question= , make difference return -1.0 (float point notation)?
If not, sta= tic analyzers=C2=A0will have less work.

best regar= ds,
Ranier Vilela
--0000000000001dd884063f161e44--