where clauses including timstamptz and intervals

From: Niels Jespersen <NJN(at)dst(dot)dk>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: where clauses including timstamptz and intervals
Date: 2021-04-09 07:24:54
Message-ID: df95450aee764d6fbedaf04613d17508@dst.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2021-04-09 10:24:00 Re: where clauses including timstamptz and intervals
Previous Message Yi Sun 2021-04-09 01:44:41 "index contains unexpected zero page" problem