How do I generate a time series in PostgreSQL?
To optimize:

SELECT x::time
FROM   generate_series(timestamp '2000-01-01 00:00'
                     , timestamp '2000-01-02 00:00'
                     , interval  '5 min') t(x);


The date is irrelevant, so use arbitrary timestamp constants. The cast to time is very cheap.
This includes lower and upper bound, so we get '00:00' twice. Use '2000-01-01 23:59' as upper bound to get it once only.

Related:


Generating time series between two dates in PostgreSQL