Re: Partitioned tables in queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 2. I found that using the now() function - and arbitrary interval will
> produce a different execution plan that using a specific date. For example:
>     assuming the current time is 16:00:
>     a) where start_date > now() - interval '4 hours' scans all child tables.
>     b) where start_date > '2006-07-21 12:00:00' only scans the child
> table with today's data.
>
> So am I to assume that the value in the query must be a constant, and
> cannot be a result of a built-in function in order for
> constraint_exclusion to work correctly?

Have you tried WHERE start_date > (SELECT now() - interval '4 hours')?
Certainly using the constant will allow CBE to work. I think that a
subquery might too.



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux