Re: Order by and timestamp

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Björn Lundin <b(dot)f(dot)lundin(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Order by and timestamp
Date: 2020-03-16 15:27:04
Message-ID: fccf0fd1-c6b4-11dc-8a5f-47fa8c1c24ba@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/16/20 1:51 AM, Björn Lundin wrote:
>
>
>> 16 mars 2020 kl. 01:41 skrev Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
>> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>>:
>>
>> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
>> <mailto:adrian(dot)klaver(at)aklaver(dot)com>> writes:
>>> On 3/15/20 2:33 PM, Björn Lundin wrote:
>>>> I then did ’select * from AMARKETS order by STARTTS’
>>
>>> Is amarkets in more then one schema?
>>
>> Yeah, it's hard to think of any explanation other than "the query used a
>> corrupt index on startts to produce the ordering".  But your \d doesn't
>> show any index on startts.  So maybe there's more than one amarkets
>> table?
>
> Yes - in other schemas - described in reply to Adrain
> But the schema_path does not point to them
> And those two other tables are empty
>
>
>> Another possibly-useful bit of evidence is to see what EXPLAIN shows as
>> the query plan for this query.
>
> bnl=> explain select * from amarkets order by startts;

Can you run as:

explain analyze select * from amarkets order by startts;

>                               QUERY PLAN
> -----------------------------------------------------------------------
>  Sort  (cost=10702.57..10939.29 rows=94691 width=106)
>    Sort Key: startts
>    ->  Seq Scan on amarkets  (cost=0.00..2875.91 rows=94691 width=106)
> (3 rader)
>
> --
> Björn Lundin
> b(dot)f(dot)lundin(at)gmail(dot)com <mailto:b(dot)f(dot)lundin(at)gmail(dot)com>
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-03-16 15:28:43 Re: Streaming replication - 11.5
Previous Message Adrian Klaver 2020-03-16 15:24:52 Re: Order by and timestamp