This answer has not yet satisfied me, my current job is working, but this is not DB computed ...
reduce(lambda h, e: h + (e.end - e.start).total_seconds(), events, 0)
It returns the duration of all events in the request in seconds
Better SQL less solutions?