[CDBI] Make CDBI go fast

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Wed Mar 21 14:58:47 GMT 2007

Perrin Harkins wrote:
> On 3/21/07, Brad Bowman <list at bereft.net> wrote:
>> Does MySQL sort the entire file to get the first 11?  Do other databases?
> It's not possible to know what the first 11 are without sorting them
> at some point.

Don't you just need to run through the file once, updating the current
first 11 at each step? I.e. compare each element against the current
11th and swap the element into the current 11 if appropriate.
Potentially a lot less comparisons and exchanges than sorting the
complete file.

But I've no idea what databases actually do.

Cheers, Dave

More information about the ClassDBI mailing list