1 /***************************************************************************** 2 3 Copyright (c) 1997, 2009, Oracle and/or its affiliates. All Rights Reserved. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License along with 22 this program; if not, write to the Free Software Foundation, Inc., 23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25 *****************************************************************************/ 26 27 /**************************************************//** 28 @file include/pars0opt.h 29 Simple SQL optimizer 30 31 Created 12/21/1997 Heikki Tuuri 32 *******************************************************/ 33 34 #ifndef pars0opt_h 35 #define pars0opt_h 36 37 #include "univ.i" 38 #include "que0types.h" 39 #include "usr0types.h" 40 #include "pars0sym.h" 41 #include "dict0types.h" 42 #include "row0sel.h" 43 44 /*******************************************************************//** 45 Optimizes a select. Decides which indexes to tables to use. The tables 46 are accessed in the order that they were written to the FROM part in the 47 select statement. */ 48 UNIV_INTERN 49 void 50 opt_search_plan( 51 /*============*/ 52 sel_node_t* sel_node); /*!< in: parsed select node */ 53 /*******************************************************************//** 54 Looks for occurrences of the columns of the table in the query subgraph and 55 adds them to the list of columns if an occurrence of the same column does not 56 already exist in the list. If the column is already in the list, puts a value 57 indirection to point to the occurrence in the column list, except if the 58 column occurrence we are looking at is in the column list, in which case 59 nothing is done. */ 60 UNIV_INTERN 61 void 62 opt_find_all_cols( 63 /*==============*/ 64 ibool copy_val, /*!< in: if TRUE, new found columns are 65 added as columns to copy */ 66 dict_index_t* index, /*!< in: index to use */ 67 sym_node_list_t* col_list, /*!< in: base node of a list where 68 to add new found columns */ 69 plan_t* plan, /*!< in: plan or NULL */ 70 que_node_t* exp); /*!< in: expression or condition */ 71 /********************************************************************//** 72 Prints info of a query plan. */ 73 UNIV_INTERN 74 void 75 opt_print_query_plan( 76 /*=================*/ 77 sel_node_t* sel_node); /*!< in: select node */ 78 79 #ifndef UNIV_NONINL 80 #include "pars0opt.ic" 81 #endif 82 83 #endif 84