I have a table:
CREATE TABLE stats_test ( id1 bigint, id2 bigint, date timestamp with time zone );
And data inside: