pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Björn Lundin <b.f.lundin@gmail.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@postgresql.org
Subject: Re: Order by and timestamp
Date: Mon, 16 Mar 2020 17:03:04 +0100
Message-ID: <116B8B6D-5619-460C-92B1-471602AC0357@gmail.com> (raw)
In-Reply-To: <fccf0fd1-c6b4-11dc-8a5f-47fa8c1c24ba@aklaver.com>
References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.com>
	<c171c26b-fd5e-b4bf-ec86-97b6f8dbcbe0@aklaver.com>
	<24142.1584319263@sss.pgh.pa.us>
	<7D74B8B5-DFBD-4B5B-85C6-A516343E49C1@gmail.com>
	<fccf0fd1-c6b4-11dc-8a5f-47fa8c1c24ba@aklaver.com>



> 16 mars 2020 kl. 16:27 skrev Adrian Klaver <adrian.klaver@aklaver.com>:
> 
> On 3/16/20 1:51 AM, Björn Lundin wrote:
>>> 16 mars 2020 kl. 01:41 skrev Tom Lane <tgl@sss.pgh.pa.us <mailto:tgl@sss.pgh.pa.us>>:
>>> 
>>> Adrian Klaver <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.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;

Yes, below the first plan

> 
>>                               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)
>> —


bnl=> explain analyze select * from amarkets order by startts;
                                                      QUERY PLAN                                                       
-----------------------------------------------------------------------------------------------------------------------
 Sort  (cost=10702.57..10939.29 rows=94691 width=106) (actual time=404.555..422.174 rows=97835 loops=1)
   Sort Key: startts
   Sort Method: quicksort  Memory: 24329kB
   ->  Seq Scan on amarkets  (cost=0.00..2875.91 rows=94691 width=106) (actual time=4.586..351.739 rows=97835 loops=1)
 Planning time: 74.707 ms
 Execution time: 434.785 ms
(6 rader)

Tid: 527,142 ms
bnl=> 




--
Björn Lundin
b.f.lundin@gmail.com

view thread (24+ messages)  latest in thread

Message-ID: <116B8B6D-5619-460C-92B1-471602AC0357@gmail.com>
Permalink:  ../116B8B6D-5619-460C-92B1-471602AC0357@gmail.com/
Also on:    postgresql.org/message-id/116B8B6D-5619-460C-92B1-471602AC0357@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: b.f.lundin@gmail.com, adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us
  Subject: Re: Order by and timestamp
  In-Reply-To: <116B8B6D-5619-460C-92B1-471602AC0357@gmail.com>
  References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.com> <c171c26b-fd5e-b4bf-ec86-97b6f8dbcbe0@aklaver.com> <24142.1584319263@sss.pgh.pa.us> <7D74B8B5-DFBD-4B5B-85C6-A516343E49C1@gmail.com> <fccf0fd1-c6b4-11dc-8a5f-47fa8c1c24ba@aklaver.com> <116B8B6D-5619-460C-92B1-471602AC0357@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox