Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGRo0-00055y-2V for pgsql-general@arkaria.postgresql.org; Tue, 16 Apr 2019 17:23:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGRny-0003GF-Ls for pgsql-general@arkaria.postgresql.org; Tue, 16 Apr 2019 17:23:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGRny-00036C-6P for pgsql-general@lists.postgresql.org; Tue, 16 Apr 2019 17:23:34 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGRnv-0001iY-St for pgsql-general@lists.postgresql.org; Tue, 16 Apr 2019 17:23:33 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5D7A721550; Tue, 16 Apr 2019 13:23:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 16 Apr 2019 13:23:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Z tipvKfeyyLiO0r99wGR0NTS6gq6xzqZ/E6EnEsat/A=; b=T4ji21nRCQp+rq0nF V5C/bXvUxoJK7TgrE+s8nyLRl92vbBN8T2mX4rOA2b2bKMyejKlK4afcJZ1fUcaN sh15oIEIh9orzL4Pl9xUcNxSjwPgsY+Owr2CACCXvGjDiSnhmvEx2Nm0yGM8B86r b1b7bnHNjV4/BogBGBOcXh0l3vdT0c/rs2ObA04SoKir8bJ816W6mI05VbVkoBR7 qNZlq0nR9M2wLbKL9l6chUQQjiXvZ2ew2c0oms5HneE13aNNPIoVVjQXnckuZV// mxzIB7j2chhLcoyLs0p/VO70HV7KTdt+vwbIot9MOiwVF/XFQHepd6yFnS4Nd6PK ExxTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=ZtipvKfeyyLiO0r99wGR0NTS6gq6xzqZ/E6EnEsat /A=; b=jkPrZ0l2fLeo6CwTizrKlTZoQwCFSZQFgLfli8F0GdDTPvy2qPO4Sl3YM Wb0TjAzKhnuFcX1+EQxTHvfQJ95NmXm4aE5BkXfyZWx92eg0rHd3oPw7uehSGi9E d1FAQImlXSqpdb5atUzMisa6a6abxMOyn8j+Mgde0eJfbK5kh93V+OTnjpJeUt0O gYjkU3XZuo6JE+fPAnXQr4S4H2XDNk1UDGgyWclHzwsaIY0lUiFUhW/fRJcbFORD TYwgGwtUPvcKXJ/wcxXBXDGm08zeqb2cwEkurU8lvZGQXu4xAMZJ0O2tduf0Uc34 4kLOktQIvP9pKdnCsLEc+BE/MMbrg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfedugdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjeegrdelgedrjeefrddvvddvnecurfgrrhgrmhepmhgrihhlfhhrohhm pegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrh fuihiivgeptd X-ME-Proxy: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B672103CC; Tue, 16 Apr 2019 13:23:29 -0400 (EDT) Subject: Re: Possible corrupt index? To: Zahir Lalani , Michael Lewis Cc: "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: <3275482c-4638-6f22-d480-bbc8fe6b9d2c@aklaver.com> Date: Tue, 16 Apr 2019 10:23:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/16/19 10:16 AM, Zahir Lalani wrote: >>Which version? What are the queries you are running which give unexpected behavior? Have your run explain analyze on those to check >what plan is being used? Have your reindexed all or only the one you suspect? > > Hi Michael > > Version: PostgreSQL 9.6.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) > 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit Is this the same for the other environments? What does: SHOW lc_collate; produce in each environment? Are you doing the below through Navicat or psql? If through Navicat, what happens if you use psql? > > LIVE – production environment (as opposed to Dev and UAT) > > Query: select id from briefs_master where ext_system_ref = '12345' > > Explain: > > Seq Scan on briefs_master  (cost=0.00..2937.90 rows=1 width=4) (actual > time=18.082..18.082 rows=0 loops=1) > >   Filter: ((ext_system_ref)::text = '12345'::text) > >   Rows Removed by Filter: 31235 > > Planning time: 0.242 ms > > Execution time: 18.096 ms > > Reindex was done initially on the primary and then on all in the table. > > So when we reset the data into the ext_system_ref field, the next query > returns fine. However, the issue is that since the system thinks there > is no primary, we are seeing this value get over-written with a null > several minutes later as other rows are added > > Z > -- Adrian Klaver adrian.klaver@aklaver.com