Field specialization is new technology introduced by Dataware that can realize large performance increases when applied to modern DBMSes. But how does it actually work?
As an anology, consider the complex road network throughout Dallas: stop signs, stop lights, interchanges, and crossroads. The road infrastructure is general purpose, in that it is designed so that anyone can drive from anywhere to anywhere else. However, think of Bob on a given day, who has to drive from the airport to his house. Since Bob is using the general-purpose roads, he has to go out of his way a bit because of the way the roads are built.
Imagine, however, if the roads of Dallas could be instantaneously rebuilt just for Bob: they were specialized to Bob's situation on this particular day. The newly-built road would be a straight line from the airport to Bob's house, with no stop lights, stop signs, or interchanges. Bob would get home in the least amount of time possible.
Field specialization works in the same way: by taking advantage of information specific to the particular environment of a DBMS. Specifically, analyses identify properties of the program’s state, e.g., the value of a variable or of an expression, that are invariant to a particular environment. This information is used for fine-grained specialization that eliminates unnecessary operations along frequently-taken execution paths, leading to optimized code that is both smaller and faster.
Often, such code is executed for every tuple in the underlying relation(s), thereby offering the possibility of significant performance improvement. Since the invariants used for specialization are available only at runtime, such specialization cannot be carried out using traditional compiler techniques: the DBMS code has to be specialized at runtime. This implies that the specialization process itself has to be extremely lightweight. (Unlike road specialization, which is at the other end of the spectrum!) One of the technical innovations of our technology is that it presents a hierarchy of different flavors of field specialization that carefully balances the cost-benefit considerations in specialization in a manner very different than is done, say, in JIT compilers.