Magnus Manske wrote:
Just thinking out loud here...
If timestamps are not unique, and revisions might not be ordered, wouldn't ORDER BY revision GROUP BY timestamp order it by timestamp, and then by revision number if two or more identical timestamps are found?
That would get around the two-query issue. Or is that too expensive?
That should work reasonably well in theory, if there was an index for it; without an index I'm not convinced it'll sort efficiently. In theory it'd be simple as you'd only have to reorder small bits here and there in the stream, but the database may not know that. :)
-- brion