16 #include "opt_explain_traditional.h"
23 static const char *traditional_extra_tags[ET_total]=
28 "Using index condition",
30 "Range checked for each record",
31 "Using where with pushed condition",
36 "Full scan on NULL key",
41 "Using index for group-by",
52 "const row not found",
53 "unique row not found",
54 "Impossible ON condition",
64 current_thd->send_explain_fields(
output));
71 return items->push_back(nil);
73 return item == NULL || items->push_back(item);
77 static bool push(
List<Item> *items,
const char *s,
size_t length)
80 return item == NULL || items->push_back(item);
86 return items->push_back(nil);
97 buff.length(buff.length() - 1);
99 buff.length(), system_charset_info);
100 return item == NULL || items->push_back(item);
108 return items->push_back(nil);
110 return item == NULL || items->push_back(item);
118 return items->push_back(nil);
120 return item == NULL || items->push_back(item);
128 return items->push_back(nil);
130 return item == NULL || items->push_back(item);
134 bool Explain_format_traditional::push_select_type(
List<Item> *items)
138 if (column_buffer.is_dependent)
140 if (buff.append(STRING_WITH_LEN(
"DEPENDENT "), system_charset_info))
143 else if (!column_buffer.is_cacheable)
145 if (buff.append(STRING_WITH_LEN(
"UNCACHEABLE "), system_charset_info))
150 if (buff.append(type))
153 buff.length(), system_charset_info);
154 return item == NULL || items->push_back(item);
161 if (push(&items, column_buffer.
col_id, nil) ||
162 push_select_type(&items) ||
164 (current_thd->lex->describe & DESCRIBE_PARTITIONS &&
168 push(&items, column_buffer.
col_key, nil) ||
170 push(&items, column_buffer.
col_ref, nil) ||
171 push(&items, column_buffer.
col_rows, nil) ||
172 (current_thd->lex->describe & DESCRIBE_EXTENDED &&
179 if (items.push_back(nil))
182 else if (!column_buffer.
col_extra.is_empty())
189 DBUG_ASSERT(traditional_extra_tags[e->
tag] != NULL);
190 if (buff.append(traditional_extra_tags[e->
tag]))
194 bool brackets=
false;
196 case ET_RANGE_CHECKED_FOR_EACH_RECORD:
197 case ET_USING_INDEX_FOR_GROUP_BY:
198 case ET_USING_JOIN_BUFFER:
205 if (e->
tag != ET_FIRST_MATCH &&
206 e->
tag != ET_PUSHED_JOIN &&
209 if (brackets && buff.append(
"("))
211 if (buff.append(e->
data))
213 if (e->
tag == ET_SCANNED_DATABASES &&
214 buff.append(e->
data[0] ==
'1' ?
" database" :
" databases"))
216 if (brackets && buff.append(
")"))
219 if (buff.append(
"; "))
222 if (!buff.is_empty())
223 buff.length(buff.length() - 2);
224 if (push(&items, buff.
dup(current_thd->mem_root), buff.length()))
233 if (
output->send_data(items))
236 column_buffer.cleanup();