/** Good */
\timing
CREATE TABLE logs (
    id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    log_time tstzrange NOT NULL
);


INSERT INTO logs (log_time)
SELECT
    tstzrange(
        y.start_time + ((x % 1334) || 'hours')::interval,
        y.end_time + ((x % 1334) || 'hours')::interval
    )
FROM generate_series(1, 400000) x,
    LATERAL (
        SELECT z.*
        FROM (
            VALUES
                ('2018-04-01 9:00'::timestamptz, '2018-04-01 12:30'::timestamptz),
                ('2018-04-01 14:00'::timestamptz, '2018-04-01 16:30'::timestamptz),
                ('2018-04-01 19:30'::timestamptz, '2018-04-01 21:00'::timestamptz)

        ) z(start_time, end_time)
    ) y;

CREATE INDEX logs_log_time_gist_idx ON logs USING gist(log_time);
CREATE INDEX logs_log_time_spgist_idx ON logs USING spgist(log_time);
