http://qs321.pair.com?node_id=483541


in reply to Midnight wraparound.

Got indexes?
A clustered index on the columns you specify will keep them in sorted order by whatever columns you specify and in what order you specify them.
create clustered index end_start_idx on schedule ( end_time, start_tim +e, event_id )

Make creating indexes part of every create table you do and you will be happy you did.
JamesNC