Search Postgresql Archives

Re: partitioning a dataset + employing hysteresis condition

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

 



On 14/11/11 18:35, Amit Dor-Shifer wrote:

On Mon, Nov 14, 2011 at 4:29 PM, Amit Dor-Shifer <amit.dor.shifer@xxxxxxxxx> wrote:
Hi,
I've got this table:
create table phone_calls
(
    start_time timestamp,
    device_id integer,
    term_status integer
);

[…]

3 points

POINT 1:
I should have given the results of my attempt...


[...]
device_id
-----------
2
40
50
60
(4 rows)


POINT 2:
I also realized I left of a condition in the HAVBING part

HAVING
    max(pc1.start_time) >= min(pc1.start_time) + interval '2 minute'

I think it should be

HAVING
        max(pc1.start_time) >= min(pc1.start_time) + interval '2 minute'
    AND pc1.term_status = 2


POINT 3:
Timestamps should almost always be stored with a time zone (using timestamptz rather than just timestamp) – or you will have problems when Summer time ends or begins, and using timestamptz allows for date&time to be displayed currectly in different locales.


Regards,
Gavin

P.S. Since my post has not shown up yet, I had to attach to its parent!
(I won't offer my first born to get direct posting rights,
as his wife may object -
besides which, it is probably illegal in my jurisdiction!)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux