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 1o91WG-0008EA-Bp for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 09:40:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o91WF-0007jT-7J for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 09:40:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o91WE-0007jK-TG for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 09:40:26 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o91WC-0008Fn-6M for pgsql-general@postgresql.org; Wed, 06 Jul 2022 09:40:25 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A2D9A5C01A8; Wed, 6 Jul 2022 05:40:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 06 Jul 2022 05:40:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1657100423; x=1657186823; bh=y FC0dwsOaz0jWlberqdEGJZwNgWaYAA8Sa0JS8m77Gc=; b=VMll2SZkgQslPMjH0 LB+ZU1OsDLRlgceALHcpIfjIQUUp1jHLXq9qU3kHtvXeEbHNPoKW9L1UKIaTaqSW mbTNAvlyguuO33mUlP3nfoENpNcbLZF/G3bxnzEfFrN+xW86iwf+mBbNYn8lopar 2sBCT0NHTGQLJA7Vvl9jxVPYrHx3iQ3j20rtqLug53zProw/p6Icwpf6+3qJMOmI ZcxI8x3pCRQIQmz7QmqA7LGyzGR3YwKYldIOL1NmmQtSQBRTbmozlE/yh3KdjPV3 tQFmDZ/QuYsmfGaU2+YrtbwtlRNxuCvV8rcuE70o/ETGCKQl+HWZ9g0hgsV10kId dRXGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeifedgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtje ertddtfeejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghr rdgvihhsvghnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhmqeenucggtffrrg htthgvrhhnpeefjeegheetuefhveevudelueeftdejteeiffetvdduhfdtieefgfeutedt veeggfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hpvghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Jul 2022 05:40:22 -0400 (EDT) Message-ID: <5404d9ee-aeed-15b1-693a-79d47bbd0a73@enterprisedb.com> Date: Wed, 6 Jul 2022 11:40:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: unable to understand query result Content-Language: en-US To: Stefan Froehlich , pgsql-general@postgresql.org References: <20220706093120.GA11952@static.231.150.9.176.clients.your-server.de> From: Peter Eisentraut In-Reply-To: <20220706093120.GA11952@static.231.150.9.176.clients.your-server.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 06.07.22 11:31, Stefan Froehlich wrote: > I have a database returing these result sets for two almost > identical queries: > > #v+ > $ select id, pid, length(pid), md5(pid) from product where pid like '8000000'; > id | pid | length | md5 > ------+---------+--------+---------------------------------- > 3594 | 8000000 | 7 | 60b5792913f4acbccf45c281fa9e3c9f > (1 row) > > $ select id, pid, length(pid), md5(pid) from product where pid like '%8000000'; > id | pid | length | md5 > ------+---------+--------+---------------------------------- > 3594 | 8000000 | 7 | 60b5792913f4acbccf45c281fa9e3c9f > 722 | 8000000 | 7 | 60b5792913f4acbccf45c281fa9e3c9f > (2 rows) > #v- Check the EXPLAIN output for the two queries. Maybe there is index corruption somewhere.