Re: Use of 'now' constant datatype in view to take advantage of partitioned table

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Patrick Dung <patrick_dkt(at)yahoo(dot)com(dot)hk>
Cc: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>, Pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Use of 'now' constant datatype in view to take advantage of partitioned table
Date: 2014-08-22 08:18:04
Message-ID: CAF-3MvPiPvraush2m36eUzJ+ymj8CUkuwEO14eSptimtbsCDeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21 August 2014 11:36, Patrick Dung <patrick_dkt(at)yahoo(dot)com(dot)hk> wrote:

> 2.
> now() is dynamic but it scan all the partitioned tables.
>

Most likely you partitioned on a timestamp without time zone, while now()
returns a timestamp with time zone. The possible time zone difference
causes that the database doesn't know in which partition to look.

In a similar vein, the function you defined to return your timestamp you
marked 'immutable', which it should most definitely not be; time moves on,
after all.

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Birta Levente 2014-08-22 10:08:01 Re: POWA tool
Previous Message Pavel Stehule 2014-08-22 07:09:59 Re: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR