Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUlVl-0000Hh-4Y for pgsql-general@arkaria.postgresql.org; Fri, 09 Apr 2021 07:25:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUlVj-0008Ul-K4 for pgsql-general@arkaria.postgresql.org; Fri, 09 Apr 2021 07:24:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUlVj-0008Ue-59 for pgsql-general@lists.postgresql.org; Fri, 09 Apr 2021 07:24:59 +0000 Received: from srvimsva2.dst.dk ([91.208.143.64]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUlVh-0006GF-5X for pgsql-general@postgresql.org; Fri, 09 Apr 2021 07:24:58 +0000 Received: from srvimsva2.dst.dk (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 783E9104076 for ; Fri, 9 Apr 2021 09:24:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dst.dk; s=dmz20180119; t=1617953095; bh=TpQXySdMAITVW/2zQXXzylcTv18gLn3l8+fSVAbxajI=; h=From:To:Date; b=RkNMClsR3CxcgXT3NIrs7ZTKWiMZ8wMqNw/pyLKchEFFVJDDy6xOIZFQ/YCG1bc3m XpjOPhamGkBz7TSS9W3q6LBR0IfQ24xkHE0ZfqUkGkmwpo/5iQX9HuzM2cb7rUWvLN 5OihqKprs249eT1D1fcZ5jFgA8lkJSjS2Q0vXQCk= Received: from srvimsva2.dst.dk (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63209104071 for ; Fri, 9 Apr 2021 09:24:55 +0200 (CEST) Received: from Sepo.dst.dk (unknown [192.168.64.12]) by srvimsva2.dst.dk (Postfix) with ESMTP for ; Fri, 9 Apr 2021 09:24:55 +0200 (CEST) Received: from srvexc8.dst.local ([172.30.32.48]) by Sepo.dst.dk (JAMES SMTP Server 2.3.2-1) with SMTP ID 532 for ; Fri, 9 Apr 2021 09:24:55 +0200 (CEST) Received: from srvexc8.dst.local (172.30.32.48) by srvexc8.dst.local (172.30.32.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 9 Apr 2021 09:24:55 +0200 Received: from srvexc8.dst.local ([fe80::9df8:5de5:1bf2:8b3b]) by srvexc8.dst.local ([fe80::9df8:5de5:1bf2:8b3b%2]) with mapi id 15.01.2106.013; Fri, 9 Apr 2021 09:24:55 +0200 From: Niels Jespersen To: "pgsql-general@postgresql.org" Subject: where clauses including timstamptz and intervals Thread-Topic: where clauses including timstamptz and intervals Thread-Index: AdctEW2+wFysdwc3R8uIUxX0Og4Ybw== Date: Fri, 9 Apr 2021 07:24:54 +0000 Message-ID: Accept-Language: da-DK, en-US Content-Language: da-DK X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.33.38] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-TM-AS-GCONF: 00 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello all Are these two queries exactly eqivalent? The table is partitioned on r_time= , which is a timestamptz. The explain plans are not exactly the same. The f= irst wants to scan a partition more than the latter.=20 select f.xx from f=20 where f.r_time >=3D '2020-10-01 00:00:00+00'::timestamptz and f.r_time < ('2020-10-01 00:00:00+00'::timestamptz + interval '1 month= '); select f.xx from f=20 where f.r_time >=3D '2020-10-01 00:00:00+00'::timestamptz and f.r_time < ('2020-11-01 00:00:00+00'::timestamptz); Regards Niels Jespersen