Cost-based optimization for magic: algebra and implementation

Seshadri, Praveen ; Hellerstein, Joseph M. ; Pirahesh, Hamid ; Leung, T. Y. Cliff ; Ramakrishnan, Raghu ; Srivastava, Divesh ; Stuckey, Peter J. ; Sudarshan, S. (1996) Cost-based optimization for magic: algebra and implementation 1996 ACM SIGMOD international conference on Management of data . pp. 435-446.

[img] PDF
1MB

Official URL: http://doi.org/10.1145/233269.233360

Related URL: http://dx.doi.org/10.1145/233269.233360

Abstract

Magic sets rewriting is a well-known optimization heuristic for complex decision-support queries. There can be many variants of this rewriting even for a single query, which differ greatly in execution performance. We propose cost-based techniques for selecting an efficient variant from the many choices.Our first contribution is a practical scheme that models magic sets rewriting as a special join method that can be added to any cost-based query optimizer. We derive cost formulas that allow an optimizer to choose the best variant of the rewriting and to decide whether it is beneficial. The order of complexity of the optimization process is preserved by limiting the search space in a reasonable manner. We have implemented this technique in IBM's DB2 C/S V2 database system. Our performance measurements demonstrate that the cost-based magic optimization technique performs well, and that without it, several poor decisions could be made.Our second contribution is a formal algebraic model of magic sets rewriting, based on an extension of the multiset relational algebra, which cleanly defines the search space and can be used in a rule-based optimizer. We introduce the multiset AMPtheta;-semijoin operator, and derive equivalence rules involving this operator. We demonstrate that magic sets rewriting for non-recursive SQL queries can be modeled as a sequential composition of these equivalence rules.

Item Type:Article
Source:Copyright of this article belongs to Association for Computing Machinery
ID Code:128536
Deposited On:27 Oct 2022 05:33
Last Modified:15 Nov 2022 07:14

Repository Staff Only: item control page