Have you seen the Nintendo Wii? This new games console is the first mass market step towards Virtual Reality that I’ve seen; soon there will probably be add-ons for it that include visors and gloves. For some reason though, the words “Virtual Reality” and Nintendo Wii do not seem to be used together in marketing advertisements.
In the same way, Oracle does not market the software in its database as being “Artificial Intelligence”, but in fact it is, in the form of the Cost Based Optimizer. There is a famous problem in artificial intelligence called “The Travelling Salesman”. The computational problem is how to work out the shortest route between say 20 cities, when there are 20 factorial (20×19x18×17…x3×2) possible routes any one of which might be the shortest. i.e. there are 2,432,902,008,176,640,000 possible routes to consider – now that is a lot of routes, and in fact would take the largest supercomputer thousands of years to process by brute force of considering each and every combination. Now compare this problem with the problem of finding the best join method between 20 tables – not the same, I know, as each table cannot be joined to any of the others, but it is similar wouldn’t you say?
Since version 7 of Oracle, there have been 2 possible methods of query optimization that the database performs; rule-based and cost-based. So why did Oracle create the cost-based model to supercede the rule-based model? The rule-based model was a relatively simple, unsophisticated means of finding an effective access path through all the table joins to the data. It consisted of 20 some rules that were each considered and an execution plan was formulated. For the most part, it was reasonably consistent and satisfactory; its main problem was that it wasn’t very flexible and didn’t adapt itself to suite the type of data it was acting on. But, well, it was …ok.
Enter the cost-based model. After a poor start, it has improved steadily over time, to the point now where Oracle are happy to declare that the rule-based model is now deprecated in 10g (although it still is actually there in the background). Now this is supposed to be ‘clever’ software; taking in to account the performance stats of your disks and CPU, the indexes available, data distribution highlights in histograms and many other variables. Each of these variables are used to construct a series of plans that are costed in terms of how much time the optimizer thinks it would take to retrieve the data; after due consideration, the plan with the least cost and hence the least expected execution time is chosen and away we go. The main difference here, and this is the artificial intelligence aspect, is that it attempts to adapt to both its hardware environment and to the data it acts on to find the fastest path to the data as opposed to blindly following simple rules.
The reality is that ideas that initially appear far out, like Artificial Intelligence and Virtual Reality, are entering our world in simpler, downplayed ways that avoid conjuring up any negative or gimicky images based on the original ideas.