Subject Re: [Firebird-Architect] Re: Some benchmarks about 'Order by' - temporary
Author Vlad Horsun
> > Yes, having all the select list's fields in sorted order is very good
> > thing as it avoid needs to reread it from tables again. This is strong
> > point no doubt.
> >
> > What i mean is that sorted runs contains whole records and during
> > merge phase we must read it from disk and write back merged larger
> > runs. Formally we need only keys to compare and merge.
> Yes, but the whole requested record should be returned to the caller.
> If they are not written after keys, how you will fast locate it in disk?

I have not good answer

Simplest way is to place records in additional file and add offsets
in that file to the sort records which will contain now keys and this
offsets. We'll get sort time independent from record size but more
space will needed and record retrieval in sorted order can be slower.