Commit graph

23 commits

Author SHA1 Message Date
Sergey Petrunya
6a7f8af3f9 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename files
2013-10-05 10:25:59 +04:00
Sergey Petrunya
fedf769f0b MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename nearly any name used by the new EXPLAIN code.
2013-10-05 09:58:22 +04:00
Sergey Petrunya
5e4044e92c MDEV-5093, MDEV-5094:
- Make EXPLAIN {PARTITIONS,EXTENDED} {UPDATE,DELETE} work.
2013-10-04 18:50:47 +04:00
Sergey Petrunya
0b69c44e94 MDEV-5067: Valgrind warnings (Invalid read) in QPF_table_access::print_explain
- Query plan footprint (in new terms, "EXPLAIN structure") should always keep 
  a copy of key_name.  This is because the table might be a temporary table which
  may be already freed by the time we use query plan footprint.
2013-09-26 14:42:30 +04:00
Sergey Petrunya
7d60030c02 MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
- If we're running explain with flags, use the same set of flags to make EXPLAIN columns 
  and contents.
2013-09-25 19:18:02 +04:00
Sergey Petrunya
d998a1635f MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='explain'
- Don't print a plan when the statement didn't produce it
- Also, add first testcase. We can't check the EXPLAIN from the slow log itself, though.
2013-09-20 17:45:24 +04:00
Sergey Petrunya
2add402891 MDEV-407: Print EXPLAIN [ANALYZE] in the slow query log
- Initial implementation.
2013-09-19 08:33:58 +04:00
Sergey Petrunya
ae6e95c498 Code cleanup. 2013-09-17 16:03:40 +04:00
Sergey Petrunya
abf4a910f2 [SHOW] EXPLAIN UPDATE/DELETE
- Make QPF structures store data members, not strings. 
  This is not fully possible, because table names (and hence 
  key names, etc) can be deleted, and we have to store strings.
2013-09-17 15:01:34 +04:00
Sergey Petrunya
69c386d9a6 Code cleanup 2013-09-04 15:37:33 +04:00
Sergey Petrunya
befacafd73 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Let Query Plan Footprint store join buffer type 
  in binary form, not string.
- Same for LooseScan type.
2013-06-27 17:56:49 +04:00
Sergey Petrunya
c0f7efb1ae Code cleanup 2013-06-27 16:28:57 +04:00
Sergey Petrunya
8b7bbcf4dc [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Make query plan be re-saved after the first join execution
  (saving it after JOIN::cleanup is too late because EXPLAIN output 
   is currently produced before that)
- Handle QPF allocation/deallocation for edge cases, like unsuccessful
  BINLOG command.
- Work around the problem with UNION's direct subselects not being visible.
- Update test results ("Using temporary; Using filesort" are now always printed 
  last in the Extra column)
- This cset gets rid of memory leaks/crashes. Some result mismatches still remain.
2013-06-27 16:41:12 +04:00
Sergey Petrunya
79392b9383 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Support "using index for group-by (scanning) " queries
2013-06-21 22:45:54 +04:00
Sergey Petrunya
cebdf3de2e [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Handle another specific case where there the JOIN 
  never had a query plan, but had multiple join->cleanup(full=true) calls
- The idea that there can only be MAX_TABLES subuqeries/unions was 
  wrong. Switch QPF_query to using a Dynamic_array.
  = make Dynamic_array template support size growth. its underlying
    DYNAMIC_ARRAY supports it. (this part will need more polishing)
2013-06-21 22:26:03 +04:00
Sergey Petrunya
af5e128e50 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Handle statements inside SPs:
  = regular statements
  = SET command, which does not have its own statement.

- Handle execution of subquery from range optimizer: 
  allocate subquery QPFs on the same MEM_ROOT as the whole 
  query plan was allocated.
2013-06-21 13:26:53 +04:00
Sergey Petrunya
52cfa54c1d [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
Single table UPDATE/DELETE
- Correctly print type=SIMPLE vs type=PRIMARY
- Handle UPDATE/DELETE of mergeable VIEWs: we get the 
  VIEW's select as the first subquery. 
  (MySQL 5.6 doesn't print it because it finds that the
   subquery is not attached to any select)
2013-06-20 20:58:26 +04:00
Sergey Petrunya
0a560289aa [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Introduce back QueryPlan/QueryPlanFootprint separation for 
  single-table UPDATEs/DELETEs
- Create an empty QueryPlanFootprint for all kinds of queries
2013-06-20 15:15:24 +04:00
Sergey Petrunya
1951d40a88 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Make EXPLAIN UPDATE/DELETE use "Query Plan Footprints", too.
2013-06-18 21:08:34 +04:00
Sergey Petrunya
1c6fc3f6b9 [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
Part 2 of:
- Pass more tests
- select with subselects is now shown with type=PRIMARY where it used to be (incorrectly) 'SIMPLE'
2013-06-18 19:21:00 +04:00
Sergey Petrunya
d2ea53aaed [SHOW] EXPLAIN UPDATE/DELETE, code re-architecting
- Pass more tests
- select with subselects is now shown with type=PRIMARY where it used to be (incorrectly) 'SIMPLE'
2013-06-18 10:57:36 +04:00
Sergey Petrunya
d97ca5f56c [SHOW] EXPLAIN UPDATE/DELETE, code reordering
- Add further details, the goal is to pass the testsuite
- SJM-nests are not printed correctly yet.
2013-06-17 19:39:55 +04:00
Sergey Petrunya
03691a7771 SHOW EXPLAIN UPDATE/DELETE
- Introduce "Query Plan Footprints" (abbrev. QPFs)
  QPF is a part of query plan that is 
  1. sufficient to produce EXPLAIN output,
  2. can be used to produce EXPLAIN output even after its subquery/union
     was executed and deleted
  3. is cheap to save so that we can always save query plans

- This patch doesn't fully address #2, we make/save strings for 
  a number of EXPLAIN's columns.  This will be fixed.
2013-06-17 11:59:38 +04:00