Column-oriented GPU-accelerated Database Management System
CoGaDB
/home/sebastian/gpudbms/trunk/cogadb/include/optimizer/optimizer.hpp
Go to the documentation of this file.
00001 
00002 #include <query_processing/query_processor.hpp>
00003 
00004 namespace CoGaDB{
00005 
00006     namespace optimizer{
00007         enum {verbose_optimizer=0};
00008         
00009         class Logical_Optimizer{
00010         public:
00011             static Logical_Optimizer& instance();
00012             bool optimize(query_processing::LogicalQueryPlanPtr);
00013         private:
00014             typedef boost::function<bool (query_processing::LogicalQueryPlanPtr)> OptimizerRule;
00015             typedef std::vector<OptimizerRule> OptimizerRules;
00016             Logical_Optimizer();
00017             Logical_Optimizer(const Logical_Optimizer&);
00018             Logical_Optimizer& operator() (const Logical_Optimizer&);
00019             OptimizerRules optimizer_rules_;
00020             
00021         };
00022 
00023         namespace optimizer_rules{
00024             bool decompose_complex_selections(query_processing::LogicalQueryPlanPtr log_plan);      
00025             bool push_down_selections(query_processing::LogicalQueryPlanPtr log_plan);
00026             bool compose_complex_selections(query_processing::LogicalQueryPlanPtr log_plan);
00027             bool cross_product_to_join(query_processing::LogicalQueryPlanPtr log_plan);
00028             bool join_order_optimization(query_processing::LogicalQueryPlanPtr log_plan);
00029         
00030         }; /* namespace optimizer_rules */
00031         
00032         
00033 //        Logical_Optimizer::Logical_Optimizer() : optimizer_rules_(){
00034 //            
00035 //                optimizer_rules_.push_back( OptimizerRule(optimizer_rules::push_down_selections) );
00036 //        }
00037 //        
00038 //        Logical_Optimizer& Logical_Optimizer::instance(){
00039 //            static Logical_Optimizer optimizer;
00040 //            return optimizer;
00041 //        }
00042 //        
00043 //        bool Logical_Optimizer::optimize(query_processing::LogicalQueryPlanPtr log_plan){
00044 //            OptimizerRules::iterator it;
00045 //            cout << "Input Plan:" < endl;
00046 //            log_plan->print();
00047 //            for(it=optimizer_rules_.begin();it!=optimizer_rules_.end();++it){
00048 //                if(!it->empty()){
00049 //                    ;
00050 //                    if(!(*it)(log_plan)){
00051 //                        cout << "Logical Optimization Failed!" << endl;
00052 //                        return false;
00053 //                    }
00054 //                }
00055 //                cout << "Optimized Plan:" < endl;
00056 //                log_plan->print();
00057 //                
00058 //            }
00059 //            return true;
00060 //
00061 //        }
00062 //        
00063 //
00064 //
00065 //        
00066 //        namespace optimizer_rules{    
00067 //            bool push_down_selections(query_processing::LogicalQueryPlanPtr log_plan){
00068 //
00069 //                struct Push_Down_Selection_Functor{
00070 //                
00071 //                    bool operator()(query_processing::LogicalQueryPlanPtr log_plan){
00072 //                    
00073 //                    
00074 //                    }
00075 //                
00076 //                };
00077 //                
00078 //                log_plan->traverse();
00079 //                return true;
00080 //            }
00081 //
00082 //            bool cross_product_to_join(query_processing::LogicalQueryPlanPtr log_plan){
00083 //                return false;
00084 //            }
00085 //
00086 //            bool join_order_optimization(query_processing::LogicalQueryPlanPtr log_plan){
00087 //                return false;
00088 //            }
00089 //        } /* namespace optimizer_rules */       
00090 //        
00091         
00092     
00093     
00094     } /* namespace optimizer */
00095 } /* namespace CoGaDB */
00096 
00097     
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines