  The LHCb experiment stores around $10^{11}$ collision events per year. A
typical physics analysis deals with a final sample of up to $10^7$ events.
Event preselection algorithms (lines) are used for data reduction. Since the
data are stored in a format that requires sequential access, the lines are
grouped into several output file streams, in order to increase the efficiency
of user analysis jobs that read these data. The scheme efficiency heavily
depends on the stream composition. By putting similar lines together and
balancing the stream sizes it is possible to reduce the overhead. We present a
method for finding an optimal stream composition. The method is applied to a
part of the LHCb data (Turbo stream) on the stage where it is prepared for user
physics analysis. This results in an expected improvement of 15% in the speed
of user analysis jobs, and will be applied on data to be recorded in 2017.
