Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jEDNL-0001s7-Qw for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2020 14:39:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jEDNK-0004kg-E3 for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2020 14:39:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jEDNK-0004kY-1Q for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2020 14:39:22 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEDNH-0007K3-7e for pgsql-general@postgresql.org; Tue, 17 Mar 2020 14:39:21 +0000 Received: by mail-lj1-x243.google.com with SMTP id g12so23173126ljj.3 for ; Tue, 17 Mar 2020 07:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=1apW6woP2lffpsH8ajcVYyCXZG5PW+IAiQTIAEzRtsA=; b=Rg0FT+zWVjOsjUdDnztnWtNvdCq/5v7BzGfRMBma6DMz3YiuIhZwZzey1DosMqPzXc iGlX3PHzUfl6kmzF/5JrGEIF2Q+JTW7olDDQLhjFI/Z6plhPu5QVWpK57alZGqYksOJ/ RJSQ/+EUc3AA1fWvZ8dcvzRLQUgaqvGLVw6fDIDccboc3Gv07H0rCzWxZY+gKWuEnm04 uulFLat+yrRXQrEBkBbxSGRqR6dqyufHGvch8J79CGTul2EvugvfGhVHyatEUt8/KqWy t7j1D2cPjQWZwEqEq4hDAPML2hN/jz08XWFYwyBUhSebmKiTAc0u1ALcTkKXdKArullM mYRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=1apW6woP2lffpsH8ajcVYyCXZG5PW+IAiQTIAEzRtsA=; b=ckS32oG43uSjT/YTZ78pK7Eh/mRdpA/avQ79oz7rHPo2IH7Ec9kH9ueZLNCj5as9Tm OcGsNEEoLMB4dImudjNsHO6uZPhuJ1rF0I3sbKSiY+UxA3mygkeB/cYahO0aAC5FWss3 yfwjLIlBPHeC9qfJZR+I+yXqmFv+ZMpM07uQEl2eQxbahKKTnNVrrT7Jc/7qgheNso+F xE7h7V8vj8xVVMn6BG+EjfhqZNteC11p1M+SnzD8dDR0r1VpuI/wyU6maljcltWjKpOc K9PYviLAd4cHqFh3nTLx+zrMz5bparIF1osZPcqYmNmLCl1sAyMl4i8RffyGjGdZtOla qhtg== X-Gm-Message-State: ANhLgQ1Bo6cc2gPwDEQ8/itM0Ik5Qpd6xS0K03n/YIU/XWgtkrrEfSQJ OXfdztv0bBOUEmSNIYrVcVQ= X-Google-Smtp-Source: ADFU+vv9NMEiOleGPYRj9JXI8od5iRKyL9VlAxFRs0d7I/e8CHcmUabjcC+qtyfAeatebjYUIPK0bQ== X-Received: by 2002:a2e:b0c7:: with SMTP id g7mr3093612ljl.255.1584455957915; Tue, 17 Mar 2020 07:39:17 -0700 (PDT) Received: from [192.168.1.183] (81-235-44-100-no276.tbcn.telia.com. [81.235.44.100]) by smtp.gmail.com with ESMTPSA id s14sm2907899ljs.63.2020.03.17.07.39.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2020 07:39:16 -0700 (PDT) From: =?utf-8?Q?Bj=C3=B6rn_Lundin?= Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_ED623729-4CAD-46A2-9087-842F2B1B1596" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Order by and timestamp SOLVED Date: Tue, 17 Mar 2020 15:39:16 +0100 In-Reply-To: <31986.1584453901@sss.pgh.pa.us> Cc: Adrian Klaver , pgsql-general@postgresql.org To: Tom Lane References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.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> <9004c731-b2eb-faaa-6dc9-6ebd231c5879@aklaver.com> <5e1a2f75-2d9c-889b-7504-63edb615caf6@aklaver.com> <33EA1F8F-5B37-41DD-B045-88FC8D207AC6@gmail.com> <1776fcbe-d55a-2059-7abf-0a615896a871@aklaver.com> <5E2FF59B-3E85-42C8-9C83-FED22A337695@gmail.com> <31986.1584453901@sss.pgh.pa.us> X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_ED623729-4CAD-46A2-9087-842F2B1B1596 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 17 mars 2020 kl. 15:05 skrev Tom Lane : >=20 > =3D?utf-8?Q?Bj=3DC3=3DB6rn_Lundin?=3D writes: >>> What happens if you use psql(9.4.15) to do sort query against 9.4.15 = server? >=20 >> However AFTER I checked the bad sorting - sep/oct 2016 and early apr = 2017=20 >> With psql 9.4 I connected with psql 9.6 again. >> And now the sorting error is gone her too! >=20 > Boy ... I don't have any confidence in that answer. It is not an answer. It is an observation. > psql does not re-sort > data, nor does it have any way to affect what the server does. I did not say that. I do not think that. But - still I got the above result * bad order with psql 9.6 towards db 9.4 * good order with psql 9.4 towards db 9.4 * good order with psql 9.6 towards db 9.4 > It seems > to me that if this actually is a version inconsistency problem, that's > a bug in itself. > I am starting to wonder though if you had psql's FETCH_COUNT option > active in one configuration and not the other, and if so whether that > could explain anything. FETCH_COUNT is a variable set in runtime / read by .psqlrc? Then it is the same.=20 I have 1 .psqlrc on ibm2. bnl@ibm2:~$ locate .psqlrc /home/bnl/.psqlrc bnl@ibm2:~$=20 bnl@ibm2:~$ cat .psqlrc \timing=20 \set AUTOCOMMIT 'off'=20 \echo 'AUTOCOMMIT' :AUTOCOMMIT But I do notice that in .psqlrc_history I see strange =E2=80=99040=E2=80=99= - sometimes=20 bnl@ibm2:~$ cat .psql_history _HiStOrY_V2_ select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040amarkets\040order\040by\040startts; select * from amarkets order by startts; =20 select\040*\040from\040amarkets\040order\040by\040startts; So I now did=20 bnl@ibm2:~$ find / -name psql /usr/lib/postgresql/9.4/bin/psql /usr/lib/postgresql/9.6/bin/psql ^C bnl@ibm2:~$ /usr/lib/postgresql/9.4/bin/psql Timing is on. AUTOCOMMIT off psql (9.4.15) Type "help" for help. bnl=3D> select * from AEVENTS order by OPENTS; Time: 278,207 ms bnl@ibm2:~$ cat .psqlrc \timing=20 \set AUTOCOMMIT 'off'=20 \echo 'AUTOCOMMIT' :AUTOCOMMIT bnl@ibm2:~$ cat .psql_history _HiStOrY_V2_ select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040amarkets\040order\040by\040startts;\040\040 select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040AEVENTS\040order\040by\040OPENTS; And yes it is Trying 9.6 bnl@ibm2:~$ /usr/lib/postgresql/9.6/bin/psql Tidtagning =C3=A4r p=C3=A5. AUTOCOMMIT off psql (9.6.15, server 9.4.15) Skriv "help" f=C3=B6r hj=C3=A4lp. bnl=3D> select * from AEVENTS order by OPENTS limit 1; Tid: 19,240 ms bnl=3D> ^D\q bnl@ibm2:~$ cat .psql_history _HiStOrY_V2_ select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040amarkets\040order\040by\040startts;\040\040 select\040*\040from\040amarkets\040order\040by\040startts; select\040*\040from\040AEVENTS\040order\040by\040OPENTS; select\040*\040from\040AEVENTS\040order\040by\040OPENTS\040limit\0401; bnl@ibm2:~$=20 And now that one too. I will move from this machine. Thanks for the suggestions, both Tom and Adrian I will keep the machine if you are interested of pursuing it, Otherwise I=E2=80=99ll stop his thread. That is, I am convinced enough that mixing versions combined with = perhaps old hardware together did something strange -- Bj=C3=B6rn Lundin b.f.lundin@gmail.com --Apple-Mail=_ED623729-4CAD-46A2-9087-842F2B1B1596 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 17 = mars 2020 kl. 15:05 skrev Tom Lane <tgl@sss.pgh.pa.us>:

=3D?utf-8?Q?Bj=3DC3=3DB6rn_Lundin?=3D <b.f.lundin@gmail.com> writes:
What = happens if you use psql(9.4.15) to do sort query against 9.4.15 = server?

However AFTER I checked the bad sorting - = sep/oct 2016 and early apr 2017
With psql 9.4 I connected = with psql 9.6 again.
And now the sorting error is =  gone her too!

Boy ... I = don't have any confidence in that answer. =

It is not an = answer. It is an observation.

 psql does = not re-sort
data, nor does it have any way to affect what = the server does.

I= did not say that. I do not think that.
But - still I got the = above result
* bad order with psql 9.6 towards db = 9.4
* good order with psql 9.4 towards db 9.4
* good = order with psql 9.6 towards db 9.4

 It = seems
to me that if this actually is a version = inconsistency problem, that's
a bug in itself.
I am starting to wonder = though if you had psql's FETCH_COUNT option
active in one = configuration and not the other, and if so whether that
could explain anything.

FETCH_COUNT is a variable set in runtime / read by = .psqlrc?
Then it is the same. 
I have 1 .psqlrc = on ibm2.

bnl@ibm2:~$ locate .psqlrc
/home/bnl/.psqlrc
bnl@ibm2:~$ 

bnl@ibm2:~$ cat .psqlrc
\timing 
\set = AUTOCOMMIT 'off' 
\echo = 'AUTOCOMMIT' :AUTOCOMMIT



But I do notice that in .psqlrc_history I see = strange =E2=80=99040=E2=80=99 - sometimes 
bnl@ibm2:~$ cat = .psql_history
_HiStOrY_V2_
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040amarkets\040order\040by\040startts;
select * from amarkets order by startts; =  
select\040*\040from\040amarkets\040order\040by\040startts;



So I now = did 
bnl@ibm2:~$ find / -name psql
/usr/lib/postgresql/9.4/bin/psql
/usr/lib/postgresql/9.6/bin/psql
^C
bnl@ibm2:~$ /usr/lib/postgresql/9.4/bin/psql
Timing is on.
AUTOCOMMIT off
psql (9.4.15)
Type "help" for help.

bnl=3D> select * from AEVENTS order = by OPENTS;
<output omitted, was ok. Different statement too = see if that is added to .psql_history>
Time: 278,207 ms


bnl@ibm2:~$ cat = .psqlrc
\timing 
\set AUTOCOMMIT = 'off' 
\echo = 'AUTOCOMMIT' :AUTOCOMMIT

bnl@ibm2:~$ cat .psql_history
_HiStOrY_V2_
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040amarkets\040order\040by\040startts;\040\= 040
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040AEVENTS\040order\040by\040OPENTS;=

And = yes it is
Trying 9.6

bnl@ibm2:~$ /usr/lib/postgresql/9.6/bin/psql
Tidtagning =C3=A4r p=C3=A5.
AUTOCOMMIT off
psql (9.6.15, server = 9.4.15)
Skriv = "help" f=C3=B6r hj=C3=A4lp.

bnl=3D>= ; select * from AEVENTS order by OPENTS limit 1;
<output omitted, was ok. Different = statement again too see if that is added to .psql_history>
Tid: 19,240 ms
bnl=3D>= ; ^D\q



bnl@ibm2:~$ cat .psql_history
_HiStOrY_V2_
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040amarkets\040order\040by\040startts;\040\= 040
select\040*\040from\040amarkets\040order\040by\040startts;
select\040*\040from\040AEVENTS\040order\040by\040OPENTS;=
select\040*\040from\040AEVENTS\040order\040by\040OPENTS\040limi= t\0401;
bnl@ibm2:~$ 

And now = that one too.


I will move from this machine.

Thanks for the suggestions, both Tom and = Adrian

I will keep the machine if = you are interested of pursuing it,
Otherwise I=E2=80=99ll stop = his thread.
That is, I am convinced enough that mixing = versions combined with perhaps old hardware
together did = something strange

--
Bj=C3=B6rn Lundin




= --Apple-Mail=_ED623729-4CAD-46A2-9087-842F2B1B1596--