More optimal timeline query