Re: [External] LIMIT not showing all results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Casey Deccio <casey(at)deccio(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: [External] LIMIT not showing all results
Date: 2019-03-05 16:46:18
Message-ID: 2871.1551804378@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Casey Deccio <casey(at)deccio(dot)net> writes:
>> On Mar 5, 2019, at 9:15 AM, Vijaykumar Jain <vjain(at)opentable(dot)com> wrote:
>> Can you run both the queries with
>> “explain analyze select ....” and paste the output.

> dnsviz=> explain analyze select id,name,date from analysis where name = 'foo' order by date desc limit 20;
> QUERY PLAN

> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> ----------------------------------
> Limit (cost=0.57..81.74 rows=20 width=31) (actual time=0.540..0.541 rows=1 loops=1)
> -> Index Scan Backward using analysis_name_date_key on analysis (cost=0.57..7760.25 rows=1912 width=31) (actual
> time=0.539..0.540 rows=1 loops=1)
> Index Cond: ((name)::text = '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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2019-03-05 16:47:07 Re: Performance comparison between Pgsql 10.5 and Pgsql 11.2
Previous Message Justin Pryzby 2019-03-05 16:21:45 Re: Question about pg_upgrade from 9.2 to X.X