Commit graph

602 commits

Author SHA1 Message Date
Sergei Petrunia
4106dfe89b Merge branch 'bb-10.1-explain-analyze' into 10.1 2015-03-24 16:26:42 +03:00
Sergey Vojtovich
18e9c314e4 MDEV-6650 - LINT_INIT emits code in non-debug builds
Replaced all references to LINT_INIT with UNINIT_VAR and LINT_INIT_STRUCT.
Removed LINT_INIT macro.
2015-03-16 14:48:22 +04:00
Sergei Petrunia
1626e0d3d4 MDEV-7648: Extra data in ANALYZE FORMAT=JSON $stmt
Show total execution time (r_total_time_ms) for various parts of the
query:
1. time spent in SELECTs
2. time spent reading rows from storage engines

#2 currently gets the data from P_S.
2015-03-07 22:47:28 +03:00
Sergei Golubchik
2db62f686e Merge branch '10.0' into 10.1 2015-03-07 13:21:02 +01:00
Vicențiu Ciorbaru
ec4ff9a2e7 MDEV-7586: Merged derived tables/VIEWs increment created_tmp_tables
Temporary table count fix. The number of temporary tables was increased
when the table is not actually created. (when do_not_open was passed
as TRUE to create_tmp_table).
2015-02-26 23:09:54 +02:00
Sergei Golubchik
4b21cd21fe Merge branch '10.0' into merge-wip 2015-01-31 21:48:47 +01:00
Sergei Golubchik
47c844f236 MDEV-7219 SQL_CALC_FOUND_ROWS yields wrong result
revert the code in filesort that conditionally updated 'found_rows',
rely on filesort_limit_arg instead.
2015-01-19 14:18:44 +01:00
Sergey Vojtovich
8fb2c80fdb Fixed valgrind warnings in delete_dynamic().
Join_plan_state performs out-of-API initialization of DYNAMIC_ARRAY. This is
done to postpone actual array initialization till first use, whilst retaining
the right to call delete_dynamic().

Since delete_dynamic() now checks DYNAMIC_ARRAY::malloc_flags it should be
initialized it as well.
2014-12-05 16:38:48 +04:00
Monty
78564373fe my_alloc.c
- Changed 0x%lx -> %p
array.c:
- Static (preallocated) buffer can now be anywhere
my_sys.h
- Define MY_INIT_BUFFER_USED
sql_delete.cc & sql_lex.cc
- Use memroot when allocating classes (avoids call to current_thd)
sql_explain.h:
- Use preallocated buffers
sql_explain.cc:
- Use preallocated buffers and memroot
sql_select.cc:
- Use multi_alloc_root() instead of many alloc_root()
- Update calls to Explain
2014-12-05 11:01:51 +04:00
Sergei Petrunia
0b5d989c89 EXPLAIN FORMAT=JSON: Add support for non-merged semi-joins 2014-11-29 01:08:18 +03:00
Sergei Petrunia
d5fbfb9a93 EXPLAIN FORMAT=JSON: Add support for single-table UPDATE/DELETE. 2014-11-28 02:36:31 +03:00
Sergei Petrunia
3d5f97fd70 Merge ../10.1-explain-json-r4 into 10.1 2014-11-27 00:51:54 +03:00
Sergei Petrunia
305dd8e5fb Better comments 2014-11-21 20:45:18 +03:00
Sergei Golubchik
1e79138459 Merge branch 'bb-10.1-merge' into 10.1 2014-10-16 00:30:29 +02:00
Sergei Golubchik
f62c12b405 Merge 10.0.14 into 10.1 2014-10-15 12:59:13 +02:00
Igor Babaev
3c4bb0e872 MDEV-334: Backport of UNION ALL optimization from mysql-5.7.
Although the original code of mysql-5.7 was adjusted
to the current MariaDB code the main ideas of the optimization
were preserved.
2014-10-14 09:36:50 -07:00
Sergei Petrunia
83f0ddc629 Merge 10.1 (with ANALYZE) and 10.1-explain-json 2014-08-09 01:52:54 +04:00
Sergei Golubchik
6fb17a0601 5.5.39 merge 2014-08-07 18:06:56 +02:00
Sergey Petrunya
6b353dd1de MDEV-6289 : Unexpected results when querying information_schema
- When traversing JOIN_TABs with first_linear_tab/next_linear_tab(), don't forget
  to enter the semi-join nest when it is the first table in the join order.
  Failure to do so could cause e.g. I_S tables not to be filled.
2014-07-23 19:53:29 +04:00
Sergei Petrunia
68bf3c5052 Code cleanup 2014-06-26 10:43:58 +04:00
Sergei Petrunia
424d5de89d Merge bb-10.1-explain-analyze into 10.1 2014-06-25 16:46:42 +04:00
Sergei Petrunia
7711999d8b MDEV-406: ANALYZE $stmt: add support for BNL join buffering 2014-06-25 15:15:38 +04:00
Sergei Petrunia
c08de06246 MDEV-406: ANALYZE $stmt: get ANALYZE work for subqueries
- "ANALYZE $stmt" should discard select's output, but it should still
  evaluate the output columns (otherwise, subqueries in select list
  are not executed)
- SHOW EXPLAIN's code practice of calling JOIN::save_explain_data()
  after JOIN::exec() is disastrous for ANALYZE, because it resets
  all counters after the first execution. It is stopped
  = "Late" test_if_skip_sort_order() calls explicitly update their part
    of the query plan.
  = Also, I had to rewrite I_S optimization to actually have optimization
    and execution stages.
2014-06-24 19:41:43 +04:00
Sergei Golubchik
2510f9c606 cleanup: remove special case from store_key::store_key(), add Field_blob::new_key_field
(prep for MDEV-6065)
2014-06-09 20:18:53 +02:00
Sergei Golubchik
fde6ee61bb revert the fix for MDEV-5898, restore the fix for MDEV-5549.
simplify test case for MDEV-5898
2014-06-05 15:59:41 +02:00
Sergei Petrunia
5621aa3230 MDEV-406: ANALYZE $stmt
- Support tracking for UNIONs, temporary-table based ORDER BYs,
  and both.
2014-06-03 17:59:01 +04:00
Sergei Petrunia
5cfd3270ec MDEV-6109: EXPLAIN JSON
- First code, "EXPLAIN FORMAT=JSON stmt" and "ANALYZE FORMAT=JSON stmt"
  work for basic queries.  Complex constructs (e.g subqueries, etc) not
  yet supported.
- No test infrastructure yet
2014-05-27 21:04:45 +04:00
Sergei Petrunia
eaba1ba4a5 Re-commit in git:
MDEV-406: ANALYZE $stmt
- Ported the old patch to new explain code
- New SQL syntax (ANALYZE $stmt)
- ANALYZE UPDATE/DELETE is now supported (because EXPLAIN UPDATE/DELETE is supported)
- Basic counters are calculated for basic kinds of queries
  (still need to see what happens with join buffer, ORDER BY...LIMIT queries, etc)
2014-05-27 20:13:17 +04:00
Sergei Golubchik
9418bd9c21 MDEV-5898 FOUND_ROWS() return incorrect value when using DISTINCT
revert the fix for MDEV-5549, use a different approach.
2014-03-19 20:33:12 +01:00
Igor Babaev
d51ee6d412 Merge. 2014-03-19 14:58:29 -07:00
Igor Babaev
06ef0bdad2 Fixed bug mdev-5191.
Corrected cost estimates when a join buffer is used and the optimizer is requested
to use condition selectivities.
2014-03-18 11:30:50 -07:00
Sergei Golubchik
0dc23679c8 10.0-base merge 2014-02-26 15:28:07 +01:00
Sergei Golubchik
0b9a0a3517 5.5 merge 2014-02-25 16:04:35 +01:00
Sergei Golubchik
ff2e82f4a1 5.3 merge 2014-02-22 22:51:20 +01:00
Sergey Vojtovich
d12c7adf71 MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863.

revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
  Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM

  Rename test() macro to MY_TEST() to avoid conflict with libc++.
2014-02-19 14:05:15 +04:00
Sergey Petrunya
8c9b2f3429 MDEV-5581: Server crashes in in JOIN::prepare on 2nd execution of PS with materialization+semijoin
- The problem was that JOIN::prepare() tried to set TABLE::maybe_null
  for a table in join. Non-merged semi-join tables 1) are present as 
  join's base tables on second EXECUTE, but 2) do not yet have a TABLE 
  object.
  Worked around the problem by putting mixed_implicit_grouping into JOIN
  object, and then passing it to JTBM tables in setup_jtbm_semi_joins().
2014-02-15 01:21:46 +04:00
Sergei Golubchik
ba26b71d31 MDEV-5549 Wrong row counter in found_rows() result
only let filesort() count rows for SQL_CALC_ROWS if it's using priority queue
2014-02-01 09:34:07 +01:00
unknown
97ecffc8ee merge 10.0-base -> 10.0 2013-10-29 22:20:45 +02:00
unknown
f4d5d849fd merge 5.5->10.0-base 2013-10-29 20:53:05 +02:00
unknown
52dea41052 Merge 5.3->5.5 2013-10-29 18:50:36 +02:00
Sergei Golubchik
0fdb3bcfdb 10.0-base merge (roles) 2013-10-29 15:08:44 +01:00
timour@askmonty.org
883af99e7d MDEV-5104 crash in Item_field::used_tables with broken order by
Analysis:
st_select_lex_unit::prepare() computes can_skip_order_by as TRUE.
As a result join->prepare() gets called with order == NULL, and
doesn't do name resolution for the inner ORDER clause. Due to this
the prepare phase doesn't detect that the query references non-exiting
function and field.
  
Later join->optimize() calls update_used_tables() for a non-resolved
Item_field, which understandably has no Field object. This call results
in a crash.

Solution:
Resolve unnecessary ORDER BY clauses to detect if they reference non-exising
objects. Then remove such clauses from the JOIN object.
2013-10-29 12:39:03 +02:00
timour@askmonty.org
afed809297 MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
BNL and BNLH joins pre-filter the records from a joined table via JOIN_TAB::cache_select->cond.
There is no need to re-evaluate the same conditions via JOIN_TAB::select_cond. This patch removes
the duplicated conditions from the top-level conjuncts of each pushed condition.

The added "Using where" in few EXPLAINs is due to taking into account tab->cache_select->cond
in addition to tab->select_cond in JOIN::save_explain_data_intern.
2013-10-18 11:45:25 +03:00
Sergey Petrunya
1e36cbfa39 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- Merge with 10.0-base
2013-10-15 11:51:41 +04:00
Sergey Petrunya
a356cfbefb MDEV-3798: EXPLAIN UPDATE/DELETE
- eliminate join_save_qpf() function.
2013-10-15 08:00:48 +04:00
Igor Babaev
ddc46740a5 Merge 5.5->10.0-base 2013-10-13 18:10:19 -07:00
Igor Babaev
c7db46a242 Merge 5.3-5.5 2013-10-13 13:43:29 -07:00
Sergey Petrunya
3c6ac6694d MDEV-3798: EXPLAIN UPDATE/DELETE
- Produce correct #rows for ORDER BY ... LIMIT N queries that take advantage of 
  ordered index read to read only N rows.
2013-10-09 13:07:46 +04:00
Sergey Petrunya
fda46df620 MDEV-3798: EXPLAIN UPDATE/DELETE
- if EXPLAIN DELETE prints "Deleting all rows", it should show the 
  expected number of rows in the rows column.
2013-10-08 14:26:14 +04:00
Sergey Petrunya
98a8642fe8 MDEV-3798: EXPLAIN UPDATE/DELETE
- Add support for EXPLAIN INSERT.
2013-10-07 17:29:51 +04:00