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 1jDlRD-0005qw-1P for pgsql-general@arkaria.postgresql.org; Mon, 16 Mar 2020 08:49:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDlRB-0000hK-Q7 for pgsql-general@arkaria.postgresql.org; Mon, 16 Mar 2020 08:49:29 +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 1jDlRB-0000hC-Bc for pgsql-general@lists.postgresql.org; Mon, 16 Mar 2020 08:49:29 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jDlR8-0001Fv-Ry for pgsql-general@postgresql.org; Mon, 16 Mar 2020 08:49:28 +0000 Received: by mail-lf1-x144.google.com with SMTP id c20so13307501lfb.0 for ; Mon, 16 Mar 2020 01:49:26 -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=pPNcg2jX200sOrcjvYZHXYmHvRjl7jdjRJjZUIPUNqg=; b=VSElZYNekZJgpHMohWaSEbO+k66AwqVAH6vmVDYcBQecYlwl6OgCu9r8qcjRHjeW7D JGPfL+do08FQBR/Va7HJpAOq8GXd8OJcGNvZ1f4WlQp4oIGoYp5H6tO4i7/EuIYloqZD +1rruSHw3CHNR33pkhEvzV2+XfGalEMOnXGjGea0bOJbNWMq2UTuc4Roe4oG9P6unCxR jupzaSqEWFxu3bYVc/zYle0G3/yFxniDoCEdUpUJdDkqEP3wMeiIS+2xg/SL0KKNc/dy ApyPdB/JjemjTJKrcnc8nZfGTBVxZ+tz58YbwqcjBBK5udSAPxwn8gowFOoucbD9ujVf rgng== 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=pPNcg2jX200sOrcjvYZHXYmHvRjl7jdjRJjZUIPUNqg=; b=s0zQcJBOYETVIvGelN2TBo7Po0Fxp5kBrJKGwRVAAqLZ/bL05/r9TRyXO2tZ1mWlF0 6e7UeeAjamiakX0PCvJXu89jU5ARHua9VprAHCXWckQGB995V8/Rsc24aP2f3lFfWY2X za1e0V+g6z4gzS1lvICmIR2WhV6Jn5VTSwFTiO8UBMygDsG7hEYZrl87BaO2Onl0T1OK uSF+TZefQjQbv+wr0RzzqTg7pEQyM7u3BAKV1w9DXTRaX74ZjML3gCtXzamkoS49Xw7W vZzn++eF1vABRLCt84T+5b+GDSPKJVN9F3+wFLr/zzca5nByT/Q6S+CDkbIyh7GETGQ+ HULg== X-Gm-Message-State: ANhLgQ3husogcM8GoS+MuBCi00nlQUjh9yKrmlvQlbz4f31Q1BaqWOJo k5WlYwY62nt4b8q+UWoVJcwibVdUw98= X-Google-Smtp-Source: ADFU+vvk1+ZJOtNYbIkDBBGRM/0Y0sKbgILYTnEAWCrC22olA8aAj0UOuEDwUSRa7RbEd6Cld5srLA== X-Received: by 2002:a05:6512:3fa:: with SMTP id n26mr8675648lfq.52.1584348565610; Mon, 16 Mar 2020 01:49:25 -0700 (PDT) Received: from imac.lan (81-227-64-79-no276.tbcn.telia.com. [81.227.64.79]) by smtp.gmail.com with ESMTPSA id y184sm3660635lfc.97.2020.03.16.01.49.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2020 01:49:24 -0700 (PDT) From: =?utf-8?Q?Bj=C3=B6rn_Lundin?= Message-Id: <48A75793-3914-40F5-877C-FD87AE85AE8A@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_CDED4D29-2A67-4499-BFDA-AEAD720AD24A" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Order by and timestamp Date: Mon, 16 Mar 2020 09:49:23 +0100 In-Reply-To: Cc: pgsql-general@postgresql.org To: Adrian Klaver References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.com> X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_CDED4D29-2A67-4499-BFDA-AEAD720AD24A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 16 mars 2020 kl. 01:37 skrev Adrian Klaver = : >=20 > On 3/15/20 2:33 PM, Bj=C3=B6rn Lundin wrote: >> Hi! >> I have an old database that behaves a bit strange. >> I keeps horse races in UK/IE. >> I have a program that continuously* adds record into a market table , >> described as below. >> *continuously means =E2=80=99after each race=E2=80=99 which is ca = 12:00 --> 23:00. >> I then did =E2=80=99select * from AMARKETS order by STARTTS=E2=80=99 >=20 > Is amarkets in more then one schema? Yes but the table is empty in other schema (=E2=80=99dry=E2=80=99) - and = has less idexes It is also present in imports - but empty there as well=20 bnl@ibm2:~$ psql -l Tidtagning =C3=A4r p=C3=A5. AUTOCOMMIT off Lista med databaser Namn | =C3=84gare | Kodning | J=C3=A4mf=C3=B6relse | Ctype = | =C3=85tkomstr=C3=A4ttigheter =20 = -----------+----------+---------+-------------+-------------+-------------= ---------- bnl | bnl | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 |=20 dry | bnl | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 |=20 imports | bnl | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 |=20 postgres | postgres | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 |=20 template0 | postgres | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 | = =3Dc/postgres + | | | | | = postgres=3DCTc/postgres template1 | postgres | UTF8 | sv_SE.UTF-8 | sv_SE.UTF-8 | = =3Dc/postgres + | | | | | = postgres=3DCTc/postgres (6 rader) bnl@ibm2:~$ \c dry -bash: c: kommandot finns inte bnl@ibm2:~$ 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> \c dry psql (9.6.15, server 9.4.15) Du =C3=A4r nu uppkopplad mot databasen "dry" som anv=C3=A4ndare "bnl". dry=3D> \d amarkets Tabell "public.amarkets" Kolumn | Typ | = Modifierare =20 = ------------------+--------------------------------+----------------------= -------------------- 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) dry=3D> select count('a') from amarkets; count=20 ------- 0 (1 rad) Tid: 2,059 ms dry=3D>=20 dry=3D> \c imports psql (9.6.15, server 9.4.15) Du =C3=A4r nu uppkopplad mot databasen "imports" som anv=C3=A4ndare = "bnl". imports=3D> \d Lista med relationer Schema | Namn | Typ | =C3=84gare=20 --------+--------------------+--------+------- public | abets | tabell | bnl public | aevents | tabell | bnl public | aevents_tmp | tabell | bnl public | amarkets | tabell | bnl public | amarkets_tmp | tabell | bnl public | aprices | tabell | bnl public | aprices_tmp | tabell | bnl public | apriceshistory | tabell | bnl public | apriceshistory_tmp | tabell | bnl public | arunners | tabell | bnl public | arunners_tmp | tabell | bnl (11 rader) imports=3D> select count('a') from amarkets; count=20 ------- 0 (1 rad) > If so what is search_path? bnl=3D> show search_path; search_path =20 ---------------- "$user",public (1 rad) > I could not replicate the below. >=20 > What does below show?: >=20 > select '2016-09-30 13:00:00'::timestamp at time zone 'UTC=E2=80=99; bnl=3D> select '2016-09-30 13:00:00'::timestamp at time zone 'UTC'; timezone =20 ------------------------ 2016-09-30 15:00:00+02 > select '2016-10-01 15:35:00'::timestamp at time zone =E2=80=99UTC=E2=80=99= bnl=3D> select '2016-10-01 15:35:00'::timestamp at time zone 'UTC'; timezone =20 ------------------------ 2016-10-01 17:35:00+02 -- Bj=C3=B6rn Lundin b.f.lundin@gmail.com --Apple-Mail=_CDED4D29-2A67-4499-BFDA-AEAD720AD24A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

16 mars 2020 kl. 01:37 skrev Adrian Klaver <adrian.klaver@aklaver.com>:

On = 3/15/20 2:33 PM, Bj=C3=B6rn Lundin wrote:
Hi!
I have an old database that = behaves a bit strange.
I keeps horse races in UK/IE.
I have a program that continuously* adds record into a market = table ,
described as below.
*continuously = means =E2=80=99after each race=E2=80=99 which is ca 12:00 --> = 23:00.
I then did =E2=80=99select * from AMARKETS order by = STARTTS=E2=80=99

Is amarkets = in more then one schema?

Yes but the table is empty in other schema = (=E2=80=99dry=E2=80=99) - and has less idexes
It is also present in imports - but empty = there as well 

bnl@ibm2:~$ psql -l
Tidtagning =C3=A4r p=C3=A5.
AUTOCOMMIT off
  =                     =           Lista med databaser
   Namn    |  = =C3=84gare   | Kodning | J=C3=A4mf=C3=B6relse  |    = Ctype    |  =C3=85tkomstr=C3=A4ttigheter  =  
-----------+----------+---------+-------------+-------------+--= ---------------------
 bnl=       | bnl      | UTF8    | = sv_SE.UTF-8 | sv_SE.UTF-8 | 
 dry=       | bnl      | UTF8    | = sv_SE.UTF-8 | sv_SE.UTF-8 | 
 imports   | bnl      | UTF8  =   | sv_SE.UTF-8 | sv_SE.UTF-8 | 
 postgres  | postgres | = UTF8    | sv_SE.UTF-8 | sv_SE.UTF-8 | 
 template0 | postgres | UTF8  =   | sv_SE.UTF-8 | sv_SE.UTF-8 | =3Dc/postgres      =     +
           |    =       |         |     =         |             = | postgres=3DCTc/postgres
 template1 | postgres | UTF8    | sv_SE.UTF-8 = | sv_SE.UTF-8 | =3Dc/postgres          = +
           |    =       |         |     =         |             = | postgres=3DCTc/postgres
(6 = rader)

bnl@ibm2:~$ \c dry
-bash: = c: kommandot finns inte
bnl@ibm2:~$ 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>= ; \c dry
psql = (9.6.15, server 9.4.15)
Du =C3=A4= r nu uppkopplad mot databasen "dry" som anv=C3=A4ndare = "bnl".
dry=3D>= ; \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)

dry=3D>= ; select count('a') from amarkets;
 count 
-------
     0
(1 = rad)

Tid: = 2,059 ms
dry=3D> 

dry=3D>= ; \c imports
psql = (9.6.15, server 9.4.15)
Du =C3=A4= r nu uppkopplad mot databasen "imports" som anv=C3=A4ndare = "bnl".
imports=3D> \d
             Lista med = relationer
 Schema |        Namn    =     |  Typ   | =C3=84gare 
--------+--------------------+--------+-------
 public | abets      =         | tabell | bnl
 public | aevents    =         | tabell | bnl
 public | aevents_tmp    =     | tabell | bnl
 public | amarkets           | = tabell | bnl
 public | amarkets_tmp       | tabell | = bnl
 public | aprices          =   | tabell | bnl
 public | aprices_tmp        | = tabell | bnl
 public | apriceshistory     | tabell | = bnl
 public | apriceshistory_tmp | tabell | = bnl
 public | arunners           | = tabell | bnl
 public | arunners_tmp       | tabell | = bnl
(11 = rader)

imports=3D> select count('a') from = amarkets;
 count 
-------
     0
(1 = rad)



If so what is = search_path?

bnl=3D> show = search_path;
  = search_path   
----------------
 "$user",public
(1 = rad)


I could not = replicate the below.

What does below = show?:

select '2016-09-30 = 13:00:00'::timestamp at time zone 'UTC=E2=80=99;

bnl=3D> select '2016-09-30 = 13:00:00'::timestamp at time zone 'UTC';
        timezone       =  
------------------------
 2016-09-30 15:00:00+02


select '2016-10-01 = 15:35:00'::timestamp at time zone =E2=80=99UTC=E2=80=99
bnl=3D>= ; select '2016-10-01 15:35:00'::timestamp at time zone = 'UTC';
  =       timezone       =  
------------------------
 2016-10-01 17:35:00+02


--
Bj=C3=B6rn Lundin




= --Apple-Mail=_CDED4D29-2A67-4499-BFDA-AEAD720AD24A--