Online sorting optimizes pipelines containing sort