pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Niels Jespersen <NJN@dst.dk>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: where clauses including timstamptz and intervals
Date: Fri, 9 Apr 2021 07:24:54 +0000
Message-ID: <df95450aee764d6fbedaf04613d17508@dst.dk> (raw)

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 first wants to scan a partition more than the latter. 

select f.xx from f 
where f.r_time  >= '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 
where f.r_time  >= '2020-10-01 00:00:00+00'::timestamptz
  and f.r_time < ('2020-11-01 00:00:00+00'::timestamptz);

Regards Niels Jespersen





view thread (6+ messages)  latest in thread

Message-ID: <df95450aee764d6fbedaf04613d17508@dst.dk>
Permalink:  ../df95450aee764d6fbedaf04613d17508@dst.dk/
Also on:    postgresql.org/message-id/df95450aee764d6fbedaf04613d17508@dst.dk

 · 

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: NJN@dst.dk
  Subject: Re: where clauses including timstamptz and intervals
  In-Reply-To: <df95450aee764d6fbedaf04613d17508@dst.dk>
  References: <df95450aee764d6fbedaf04613d17508@dst.dk>

* 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