Re: [CDBI] Make CDBI go fast
Dave Howorth <dhoworth-fDajt2Yx3S8pY9vWkoisglpr/1R2p/[email protected]> Wed, 21 Mar 2007 14:58:47 +0000
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Organization | MRC Centre for Protein Engineering |
| Message-ID | <[email protected]> |
Perrin Harkins wrote: > On 3/21/07, Brad Bowman <[email protected]> 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