Field Specialization: Reusable and Independent
Field specialization has two especially helpful attributes. First, specializations are reusable across queries. Second, specializations are independent of each other.
A specialization is applied to a specific hotspot revealed by dynamic analysis tools that collect information during program execution. In a DBMS, examples of such hotspots are the table scan operation, the evaluation of aggregate functions, and the evaluation of predicates. Given that these operations can be exercised by many different queries and workloads, the specializations of these operations can benefit many queries without change, thereby rendering the specialization reusable .
As shown in the figure below, plotting the contribution of various spiffs to speedup, over TPC-H queries running on Postgres, most specializations (for instance, the table spiff, shown in yellow), are utilized by almost all the queries. Depending on the size of the table(s) that a query references, the benefit of the specialization varies. As another example, just a few queries require string comparison in predicates or during sorting. Thus, the string spiff (shown in orange) will benefit the queries that require string comparisons.
From this plot, we can also observe that each specialization independently brings improvement to a query. Again, this is because that each specialization is applied to address a unique hotspot in program execution. The overall performance improvement achieved by applying a series of specializations is additive.