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: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Order by and timestamp
Date: Mon, 16 Mar 2020 11:03:55 +0100
Message-ID: <346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com> (raw)
In-Reply-To: <7D74B8B5-DFBD-4B5B-85C6-A516343E49C1@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>



>> 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.

bnl=# select version();
                                                            version                                                            
-------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit
(1 row)

bnl@tp:~$ uname -a
Linux tp 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


It misses som later record (from 2020) but otherwise contains the same data, and same definition
It is also the only user-database on the system

bnl=# \d amarkets
                                      Table "public.amarkets"
      Column      |              Type              | Collation | Nullable |        Default         
------------------+--------------------------------+-----------+----------+------------------------
 marketid         | character varying(11)          |           | not null | ' '::character varying
 marketname       | character varying(50)          |           | not null | ' '::character varying
 startts          | timestamp(3) without time zone |           | not null | 
 eventid          | character varying(11)          |           | not null | ' '::character varying
 markettype       | character varying(25)          |           | not null | ' '::character varying
 status           | character varying(50)          |           | not null | ' '::character varying
 betdelay         | integer                        |           | not null | 1
 numwinners       | integer                        |           | not null | 1
 numrunners       | integer                        |           | not null | 1
 numactiverunners | integer                        |           | not null | 1
 totalmatched     | numeric(15,2)                  |           | not null | 0.0
 totalavailable   | numeric(15,2)                  |           | not null | 0.0
 ixxlupd          | character varying(15)          |           | not null | ' '::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)


This gets it correctly.

So it points to something on the first machine.
Recreating indexes is a possibility, but (to me) a bit unintuitive since there are no index on startts
I’ll do that tomorrow.


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

view thread (24+ messages)  latest in thread

Message-ID: <346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com>
Permalink:  ../346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com/
Also on:    postgresql.org/message-id/346C3B58-D29E-4CC2-8200-691ECA91F494@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, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com
  Subject: Re: Order by and timestamp
  In-Reply-To: <346C3B58-D29E-4CC2-8200-691ECA91F494@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>

* 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