Re: Why is the comparison between timestamp and date so much slower then between two dates

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is the comparison between timestamp and date so much slower then between two dates
Date: 2016-04-14 06:37:18
Message-ID: nendqu$sq1$2@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alban Hertroys schrieb am 13.04.2016 um 16:39:
>>> So my question is: why is comparing a timestamp to a date so much slower?
>
> The reason that the other way around is so much more expensive is that
> the database needs to do that conversion twice for every row in the
> table. When down-converting now(), the DB only needs to do that once
> for all rows.

Why does it do that for each row? The value of now() won't
change while the statement is running, so this conversion could
be done once at the start of the statement.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Moreno Andreo 2016-04-14 09:11:59 Re: Multimaster
Previous Message Thomas Kellerer 2016-04-14 06:36:14 Re: Why is the comparison between timestamp and date so much slower then between two dates