Jeg tror, at din "opdelt efter tid" ønskede output-eksempel er forkert og burde i stedet være dette
1=> 2014-01-01 23:43:00 - 2014-01-02 02:30:00, as date 2014-01-01
2=> 2014-01-02 02:30:01 - 2014-01-03 02:30:00, as date 2014-01-02
3=> 2014-01-03 02:30:01 - 2014-01-03 03:33:00, as date 2014-01-03
Hvis det er tilfældet, så gør det her
select day, count(*)
from (
select generate_series(
(start_time - interval '2 hours 30 minutes')::date,
stop_time,
interval '1 day'
)::date as day
from t
) s
group by day
order by day