in reply to speeding up row by row lookup in a large db
Let's take a history-lesson from ... punched cards, of all things. When you have a large amount of data, sort it. If you have multiple data streams to integrate, sort each one by the same key.
When you do this, all the records having any key value will be adjacent, and within any gaps there are known to be no keys at all. No searching is required, and you never need to consider anything more than: this record, and the preceding one.
The thing that is eating your lunch here is a familiar one: thousands (or millions) of repetitive searches. “Come with me back to the days when more data than this was processed using much less computer power than today you will find in a dishwasher. It was not a world of hard drives: it was a world of magnetic tapes.” The procedures that were adopted out of necessity back then, are just as efficient today.
The payoff for your efforts can be ... stunning.
Replies are listed 'Best First'. | |
---|---|
Re^2: speeding up row by row lookup in a large db
by punkish (Priest) on Mar 22, 2009 at 02:32 UTC | |
by xcramps (Novice) on Mar 22, 2009 at 15:56 UTC | |
by punkish (Priest) on Mar 23, 2009 at 02:09 UTC | |
by BrowserUk (Patriarch) on Mar 23, 2009 at 03:27 UTC | |
by punkish (Priest) on Mar 23, 2009 at 03:32 UTC | |
|