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 1rnbfi-00E7J1-2p for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Mar 2024 09:58:46 +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 1rnbfg-001xF3-Gx for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Mar 2024 09:58:45 +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 1rnXgA-000j8h-9B for pgsql-bugs@lists.postgresql.org; Fri, 22 Mar 2024 05:42:58 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rnXg6-005qlJ-K4 for pgsql-bugs@lists.postgresql.org; Fri, 22 Mar 2024 05:42:57 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-513e14b2bd9so2118533e87.2 for ; Thu, 21 Mar 2024 22:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impactdatametrics-com.20230601.gappssmtp.com; s=20230601; t=1711086174; x=1711690974; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0UU4Py2hZ0uZOnIqVOi0r+qyEo1JA13hPP7HJB1LGLs=; b=HGSuqKz71vt78Lc3DoxkFEpvbxGbshb1u1qwp8Ufmj3D0bBEbLvsdlIiDu8vjY0nB3 OoNSVbNb0nVwKHnUsovpkm2nnrs7dPdS7xCuArzBMnGina5jwMp7wPicxLXhOXSG5Y5L xGOOhqGAr7wXt5wI2BVlpVfRm5/q/kh41/BPL46idK1qSymzpYTxR7336+fz3qWiefkL F2bfK98MNhey1cBReLLGJ/fHnJJ8pGgCOdTA7uBRKzBa65rNKUM8o10XisSw9NlKzfBR Vy/J2Y+PbxgLWwbtruVM1ukvw4itb/G65p1CXyK4o4kc+NmgtBUGRhpgtE0s27jlvW8F KYlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711086174; x=1711690974; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0UU4Py2hZ0uZOnIqVOi0r+qyEo1JA13hPP7HJB1LGLs=; b=PdMgTw9hjbRqmTlrHXpTKVF9mB8hmn41lgNBzquQ5xBtk0UU0k1RlTCPwHeAoBCxmp tz1tkr1Cf0uWxI9TE8tJuS1tQ4o29V+EOOOsReF5vtk+d4p4NjuppjTjFlBNwgzBWzR+ 09nazV8CKaMRF3FubbRM+wAS6cmLsr5lfIa2yLhD2H9eJTrKE5wxfwobKiRuPYuvw2Up dZnPkaf+FvRObl5+cHQeKlVB4SttZO/LVk8osZ0MXWJRjzg9zXqowl4+Bbav1TjpGLDE fIv0O5Ehw5XmEyJPR+7y6ye8NhuaY4ILnRIqb6IrXqf+pdjFxvcFZE5yUS43NKPML7TF dlWg== X-Gm-Message-State: AOJu0YwUHFXXeNm4BmxIyLK8Rhk+kPPBBLD7wHj/i8b2vuM3ygtB+6Ot izyVpVx9yheYVMBqBt/dhpZaWqcTyBOFUIEBUdEdaYiGfApnS2TwNknZlBhMhlw= X-Google-Smtp-Source: AGHT+IHoPGvgG7La6lCg4jmMHacT4/MyMelcFbMmr3mCK1kIpWXjCWQBHRdC+5HibQHlelrqtvJqaQ== X-Received: by 2002:ac2:5614:0:b0:513:d71e:eeb4 with SMTP id v20-20020ac25614000000b00513d71eeeb4mr863699lfd.18.1711086173687; Thu, 21 Mar 2024 22:42:53 -0700 (PDT) Received: from smtpclient.apple ([78.116.254.170]) by smtp.gmail.com with ESMTPSA id iv20-20020a05600c549400b004146bce65f4sm7666166wmb.13.2024.03.21.22.42.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Mar 2024 22:42:53 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.100.2.1.4\)) Subject: Re: Index plan returns different results to sequential scan From: John Burns In-Reply-To: <27496161-e7ec-47bd-b559-3571fde4dcb4@enterprisedb.com> Date: Fri, 22 Mar 2024 06:42:42 +0100 Cc: pgsql-bugs@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <3D84D157-24B4-447E-AA77-B80DF8543378@impactdatametrics.com> References: <3B86F188-F4BF-4331-AD79-E5FF2D0711A3@impactdatametrics.com> <72600f8a-4231-45b7-a116-8ceec5ccf66e@enterprisedb.com> <881DF028-5222-486C-A13B-451239C1316F@impactdatametrics.com> <27496161-e7ec-47bd-b559-3571fde4dcb4@enterprisedb.com> To: Tomas Vondra X-Mailer: Apple Mail (2.3774.100.2.1.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I=E2=80=99m sorry, but I can=E2=80=99t really say when it broke =E2=80=94 = we suspect when we went from version 14 to 16 =E2=80=94 we use this = functionality a lot, and we would have noticed long ago if it was wrong. As additional information, I created a new operator that used another = function =E2=80=94 wrapping the function postcode_cmp_partial(...) =3D = 0 =E2=80=94 and it exhibited the same behaviour. =20 Not surprised since the postcode_eq_partial is a trivially simple = function. =20 =E2=80=94 John Burns=20 > On 22 Mar 2024, at 00:58, Tomas Vondra = wrote: >=20 >=20 >=20 > On 3/21/24 21:08, John Burns wrote: >>=20 >>=20 >>> On 21 Mar 2024, at 20:27, Tomas Vondra = wrote: >>>=20 >>>=20 >>> Sorry about that =E2=80=A6 the patched version of the package, plus = a sample data set is in the attached zip file, >>>=20 >>> -John=20 >>>=20 >=20 > Thanks, I can reproduce the issue. I don't know why is it happening, = but > the behavior I see is that the (postcode % 'NW10') query somehow = misses > rows with postcodes 'NW10 0AA' - 'NW10 3NL' when executed using index. >=20 > I don't see anything obviously wrong in the extension / index pages. >=20 > You suggested it used to work OK and then broke. Do you perhaps know = at > which version it broke? Or did you use 9.x until now, upgrades to 16 = and > realized it's broken? >=20 >=20 > regards >=20 > --=20 > Tomas Vondra > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company