Re: Using Calcite for query planning
Ok, thank you very much Julian, we'll try it out. Best regards, Davide and Guohui. On 14/02/18 19:42, Julian Hyde wrote: It sounds like a good fit. Parse the SQL, translate to relational algebra, apply some query transformation rules on the algebra. If you have a few simple transformations in mind, you may be able to achieve it without a cost model. Or, as you propose, a simple model based on cardinality. To convert a union of conjunctive queries to a conjunction of possibly-union queries, you would probably need a rule called UnionJoinTransposeRule that converts (Union (Join X Y) (Join X Y)) into (Join X (Union Y Z)) or something like that, and combines it with some existing rules to push unions. There is currently no such rule but it would not be hard to write. Julian On Feb 14, 2018, at 5:24 AM, Guohui Xiao wrote: Hi, We are considering using Calcite to perform cost-based query optimization in our project. Specifically, we can already generate some SQL queries expressed in some relational algebra expression through our API, and we want to optimize the generated expressions using Calcite. We have a cost model based on cardinality estimation. We want to use it to convert e.g., a union of conjunctive queries (UCQ) into a a join of UCQs. We would like to understand how much efforts are needed to realize our idea using Calcite. Do you have suggestions about this? Thanks in advance. Best regards, Guohui & Davide -- Guohui Xiao, PhD Assistant Professor with a fixed-term contract KRDB - Faculty of Computer Science Free University of Bozen-Bolzano Piazza Domenicani, 3 I-39100 Bolzano, Italy http://www.ghxiao.org
Re: Using Calcite for query planning
It sounds like a good fit. Parse the SQL, translate to relational algebra, apply some query transformation rules on the algebra. If you have a few simple transformations in mind, you may be able to achieve it without a cost model. Or, as you propose, a simple model based on cardinality. To convert a union of conjunctive queries to a conjunction of possibly-union queries, you would probably need a rule called UnionJoinTransposeRule that converts (Union (Join X Y) (Join X Y)) into (Join X (Union Y Z)) or something like that, and combines it with some existing rules to push unions. There is currently no such rule but it would not be hard to write. Julian > On Feb 14, 2018, at 5:24 AM, Guohui Xiao wrote: > > Hi, > > We are considering using Calcite to perform cost-based query optimization > in our project. > > Specifically, we can already generate some SQL queries expressed in some > relational algebra expression through our API, and we want to optimize the > generated expressions using Calcite. > > We have a cost model based on cardinality estimation. We want to use it to > convert e.g., a union of conjunctive queries (UCQ) into a a join of UCQs. > > We would like to understand how much efforts are needed to realize our idea > using Calcite. > > Do you have suggestions about this? > > Thanks in advance. > > Best regards, > > Guohui & Davide > > > > -- > Guohui Xiao, PhD > Assistant Professor with a fixed-term contract > KRDB - Faculty of Computer Science > Free University of Bozen-Bolzano > Piazza Domenicani, 3 > I-39100 Bolzano, Italy > > http://www.ghxiao.org
Using Calcite for query planning
Hi, We are considering using Calcite to perform cost-based query optimization in our project. Specifically, we can already generate some SQL queries expressed in some relational algebra expression through our API, and we want to optimize the generated expressions using Calcite. We have a cost model based on cardinality estimation. We want to use it to convert e.g., a union of conjunctive queries (UCQ) into a a join of UCQs. We would like to understand how much efforts are needed to realize our idea using Calcite. Do you have suggestions about this? Thanks in advance. Best regards, Guohui & Davide -- Guohui Xiao, PhD Assistant Professor with a fixed-term contract KRDB - Faculty of Computer Science Free University of Bozen-Bolzano Piazza Domenicani, 3 I-39100 Bolzano, Italy http://www.ghxiao.org