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