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:15:45 +0100
Message-ID: <72890A04-294E-4753-8839-69F0BAD9AA17@gmail.com> (raw)
In-Reply-To: <10f84f23-6011-28ab-79a1-a1c259424d2e@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>
	<346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com>
	<10f84f23-6011-28ab-79a1-a1c259424d2e@aklaver.com>



> 16 mars 2020 kl. 16:46 skrev Adrian Klaver <adrian.klaver@aklaver.com>:
> 
> On 3/16/20 3:03 AM, Björn Lundin wrote:
>>>> 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?
>> I realize that I have (basically) the same dataset on another machine.
> 
> Which brings me back to your first post where you had:
> 
> Timing is on.
> AUTOCOMMIT off
> psql (9.6.10)
> Type "help" for help.
> 
> Then you said the database was:
> 
>                                     version 
> ------------------------------------------------------------------------------------------------
> PostgreSQL 9.4.15 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit
> (1 rad)
> 
> Which seemed to be confirmed by:
> 
> bnl@ibm2:~$ psql
> Tidtagning är på.
> AUTOCOMMIT off
> psql (9.6.15, server 9.4.15)
> Skriv "help" för hjälp.
> 
> 
> That leaves me wondering how you got to the output in the first post?


Ooh - terrible sorry.
The output from first post describing the database schema
Was actually from my production machine - a raspberry pi.
The pi hold a db on an usb-disk, which is pg_dump()ed every night and imported to ibm2 history db (the bad one) 

The schema is identical to the one with trouble - which is a history database
Intended for testing

I did not realize that would matter when posting - did the post away from home,
I can reach the prod machine but not the history machine (ibm2) from outside.
 
So - from the pi - first post

bnl=# \q
bnl@pibetbot:~ $ psql
Timing is on.
AUTOCOMMIT off
psql (9.6.10)
Type "help" for help.

bnl=# \d amarkets
                                   Table "public.amarkets"
      Column      |              Type              |                Modifiers                
------------------+--------------------------------+-----------------------------------------
 marketid         | character varying(11)          | not null default ' '::character varying
 marketname       | character varying(50)          | not null default ' '::character varying
 startts          | timestamp(3) without time zone | not null
 eventid          | character varying(11)          | not null default ' '::character varying
 markettype       | character varying(25)          | not null default ' '::character varying
 status           | character varying(50)          | not null default ' '::character varying
 betdelay         | integer                        | not null default 1
 numwinners       | integer                        | not null default 1
 numrunners       | integer                        | not null default 1
 numactiverunners | integer                        | not null default 1
 totalmatched     | numeric(15,2)                  | not null default 0.0
 totalavailable   | numeric(15,2)                  | not null default 0.0
 ixxlupd          | character varying(15)          | not null default ' '::character varying
 ixxluts          | timestamp(3) without time zone | not null
Indexes:
    "amarketsp1" PRIMARY KEY, btree (marketid)
    "amarketsi2" btree (eventid)
    "amarketsi3" btree (markettype)
    "amarketsi4" btree (status)
    "amarketsi5" btree (numwinners)
    "amarketsi6" btree (ixxluts)

bnl=# \q
bnl@pibetbot:~ $ logout
Connection to 192.168.1.7 closed.

From the machine (ibm2) with bad sort order


imac:~ bnl$ ssh 192.168.1.20
bnl@192.168.1.20's password: 
Linux ibm2 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
Last login: Mon Mar 16 16:54:56 2020 from 192.168.1.174
bnl@ibm2:~$ psql
Tidtagning är på.
AUTOCOMMIT off
psql (9.6.15, server 9.4.15)
Skriv "help" för hjälp.

bnl=> \d amarkets
                                   Tabell "public.amarkets"
      Kolumn      |              Typ               |               Modifierare                
------------------+--------------------------------+------------------------------------------
 marketid         | character varying(11)          | inte null default ' '::character varying
 marketname       | character varying(50)          | inte null default ' '::character varying
 startts          | timestamp(3) without time zone | inte null
 eventid          | character varying(11)          | inte null default ' '::character varying
 markettype       | character varying(25)          | inte null default ' '::character varying
 status           | character varying(50)          | inte null default ' '::character varying
 betdelay         | integer                        | inte null default 1
 numwinners       | integer                        | inte null default 1
 numrunners       | integer                        | inte null default 1
 numactiverunners | integer                        | inte null default 1
 totalmatched     | numeric(15,2)                  | inte null default 0.0
 totalavailable   | numeric(15,2)                  | inte null default 0.0
 ixxlupd          | character varying(15)          | inte null default ' '::character varying
 ixxluts          | timestamp(3) without time zone | inte null
Index:
    "amarketsp1" PRIMARY KEY, btree (marketid)
    "amarketsi2" btree (eventid)
    "amarketsi3" btree (markettype)
    "amarketsi4" btree (status)
    "amarketsi5" btree (numwinners)
    "amarketsi6" btree (ixxluts)

bnl=> 





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

view thread (24+ messages)  latest in thread

Message-ID: <72890A04-294E-4753-8839-69F0BAD9AA17@gmail.com>
Permalink:  ../72890A04-294E-4753-8839-69F0BAD9AA17@gmail.com/
Also on:    postgresql.org/message-id/72890A04-294E-4753-8839-69F0BAD9AA17@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: <72890A04-294E-4753-8839-69F0BAD9AA17@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> <346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com> <10f84f23-6011-28ab-79a1-a1c259424d2e@aklaver.com> <72890A04-294E-4753-8839-69F0BAD9AA17@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