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 1h1DD2-0008Ls-2M for pgsql-general@arkaria.postgresql.org; Tue, 05 Mar 2019 16:46:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1DD0-0000vS-It for pgsql-general@arkaria.postgresql.org; Tue, 05 Mar 2019 16:46:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1DD0-0000vL-AD for pgsql-general@lists.postgresql.org; Tue, 05 Mar 2019 16:46:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1DCx-0005gk-VL for pgsql-general@lists.postgresql.org; Tue, 05 Mar 2019 16:46:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x25GkIne002872; Tue, 5 Mar 2019 11:46:18 -0500 From: Tom Lane To: Casey Deccio cc: pgsql-general@lists.postgresql.org Subject: Re: [External] LIMIT not showing all results In-reply-to: <2AA9443B-57B7-4088-8B8F-957703E206F0@deccio.net> References: <85CFAA9E-E10B-4B1E-8C79-7793CC92BA82@deccio.net> <2AA9443B-57B7-4088-8B8F-957703E206F0@deccio.net> Comments: In-reply-to Casey Deccio message dated "Tue, 05 Mar 2019 09:20:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2870.1551804378.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 05 Mar 2019 11:46:18 -0500 Message-ID: <2871.1551804378@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Casey Deccio writes: >> On Mar 5, 2019, at 9:15 AM, Vijaykumar Jain wrote= : >> Can you run both the queries with >> =E2=80=9Cexplain analyze select ....=E2=80=9D and paste the output. > dnsviz=3D> explain analyze select id,name,date from analysis where name = =3D 'foo' order by date desc limit 20; = > = QUERY PLAN = = = = = > ------------------------------------------------------------------------= --------------------------------------------------------------------------= ------------------------- > ---------------------------------- = = = > Limit (cost=3D0.57..81.74 rows=3D20 width=3D31) (actual time=3D0.540..= 0.541 rows=3D1 loops=3D1) = = > -> Index Scan Backward using analysis_name_date_key on analysis (co= st=3D0.57..7760.25 rows=3D1912 width=3D31) (actual = > time=3D0.539..0.540 rows=3D1 loops=3D1) = = = > Index Cond: ((name)::text =3D 'foo'::text) > Planning time: 6.728 ms > Execution time: 0.587 ms > (5 rows) Hm, so possibly corruption in that index? REINDEX might help. regards, tom lane