Commit graph

1119 commits

Author SHA1 Message Date
Sergei Golubchik
7f5e51b940 MDEV-34 delete storage/ndb and sql/*ndb* (and collateral changes)
remove:
* NDB from everywhere
* IM from mtr-v1
* packaging/rpm-oel and packaging/rpm-uln
* few unused spec files
* plug.in file
* .bzrignore
2014-10-11 18:53:06 +02:00
Sergei Golubchik
43d1f0b6b9 cleanup: rename List<> methods
prepand() -> prepend()
concat() -> append()
2014-10-10 22:27:37 +02:00
Sergei Petrunia
8707f172e1 Merge 10.1 into bb-10.1-mdev6657 2014-09-09 13:46:33 +04:00
Sergei Petrunia
c945233a19 MDEV-6657: Poor plan choice for ORDER BY key DESC optimization...
The problem was caused by the following scenario:
- range optimizer picks an index IDX1 which doesn't match the ORDER BY ...
  LIMIT clause.
- test_if_skip_sort_order() decides to switch to index IDX2 which matches
  the ORDER BY ... LIMIT.
- it runs SQL_SELECT::test_quick_select() for the second time to produce
  an quick select for IDX2.
- However, test_quick_select() would figure that full index scan on IDX1
  is still cheaper (its calculations ignore the LIMIT n).

Fixed this by
- passing force_quick_range=true to test_quick_select()
- in test_quick_select, don't consider full index scans if the mentioned
  parameter is true.

Numerous changes in .result files are caused by test_quick_select() being
run after "early/late NULLs filtering" feature has injected NOT NULL
condition.
2014-09-02 18:54:29 +04:00
Sergei Petrunia
f1a1683309 MDEV-6384: It seems like OPTIMIZER take into account the order of indexes in the table
When ORDER BY ... LIMIT check whether it should switch from index IDX1
to index IDX2, it should not ignore the fact that IDX2 may have a
potential range or ref(const) access.
Istead, it should calculate their costs: there is now a saved range
optimizer cost and code to re-calculate what best_access_path()
calculated for ref(const).

/* in current cost model these two can be very different
numbers unfortunately */
2014-08-27 20:08:32 +04:00
Sergei Petrunia
be00e279c6 MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE
Let range optimizer remove parts of OR-clauses for which range analysis
produced SEL_TREE(IMPOSSIBLE).
There is no need to remove parts of AND-clauses: either they are inside
of OR (and the whole AND-clause will be removed), or the AND-clause is
at the top level, in which case the whole WHERE (or ON) is always FALSE
and this is a degenerate case which receives special treatment.

The removal process takes care not to produce 1-way ORs (in that case
we substitute the OR for its remaining member).
2014-08-27 18:47:33 +04:00
Sergei Petrunia
378878e1e9 MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate
IS [NOT] NULL predicate is sargable within an outer join. Range
analysis only uses predicates from ON expressions, which have
regular semantics (without null-complemented rows, etc).
There is no reason not use IS [NOT] NULL predicates.
2014-08-24 12:36:51 +04:00
Sergei Golubchik
e27c338634 5.5.38 merge 2014-06-06 00:07:27 +02:00
Sergey Petrunya
c7e5a1f70d MDEV-6105: Emoji unicode character string search query makes mariadb performance down
- When range optimizer cannot the lookup value into [VAR]CHAR(n) column,
  it should produce:
  = "Impossible range" for equality
  = "no range" for non-equalities.
2014-06-05 19:18:35 +04:00
Igor Babaev
d130cef416 Fixed the problem of mdev-6198: statistics.test fails in valgrind.
The problem appeared when a loose scan used a key prefix whose
last component called uint3korr in the implementation of the key_cmp
virtual function.
2014-05-02 15:47:50 -07:00
Sergey Petrunya
182f7d76ee Revert these two changes (wrong push) :
MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
- Made a number of fixes in table_cond_selectivity() so that it returns
  correct selectivity estimates.
- Added comments in related code.
Better comments
2014-04-28 21:49:39 +04:00
Sergey Petrunya
deb26989e9 MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
- Made a number of fixes in table_cond_selectivity() so that it returns
  correct selectivity estimates.
- Added comments in related code.
2014-04-21 15:37:55 +04:00
Igor Babaev
bcf16fa612 Merge. 2014-04-22 14:43:13 -07:00
Igor Babaev
3e0f63c18f Fixed the problem of mdev-5947.
Back-ported from the mysql 5.6 code line the patch with
the following comment:

  Fix for Bug#11757108 CHANGE IN EXECUTION PLAN FOR COUNT_DISTINCT_GROUP_ON_KEY
                       CAUSES PEFORMANCE REGRESSION

  The cause for the performance regression is that the access strategy for the
  GROUP BY query is changed form using "index scan" in mysql-5.1 to use "loose
  index scan" in mysql-5.5. The index used for group by is unique and thus each
  "loose scan" group will only contain one record. Since loose scan needs to
  re-position on each "loose scan" group this query will do a re-position for
  each index entry. Compared to just reading the next index entry as a normal
  index scan does, the use of loose scan for this query becomes more expensive.

  The cause for selecting to use loose scan for this query is that in the current
  code when the size of the "loose scan" group is one, the formula for
  calculating the cost estimates becomes almost identical to the cost of using
  normal index scan. Differences in use of integer versus floating point arithmetic
  can cause one or the other access strategy to be selected.

  The main issue with the formula for estimating the cost of using loose scan is
  that it does not take into account that it is more costly to do a re-position
  for each "loose scan" group compared to just reading the next index entry.
  Both index scan and loose scan estimates the cpu cost as:

    "number of entries needed too read/scan" * ROW_EVALUATE_COST

  The results from testing with the query in this bug indicates that the real
  cost for doing re-position four to eight times higher than just reading the
  next index entry. Thus, the cpu cost estimate for loose scan should be increased.
  To account for the extra work to re-position in the index we increase the
  cost for loose index scan to include the cost of navigating the index.
  This is modelled as a function of the height of the b-tree:

    navigation cost= ceil(log(records in table)/log(indexes per block))
                   * ROWID_COMPARE_COST;

  This will avoid loose index scan being used for indexes where the "loose scan"
  group contains very few index entries.
2014-04-22 14:39:57 -07:00
Sergey Petrunya
7216afbc78 MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503 ...
- Backport the fix for MySQL Bug#13947868
- Add our testcase (they don't publish theirs)
2014-04-18 14:07:54 +04:00
Sergey Petrunya
26a3d567c9 MDEV-5992: EITS: Selectivity of non-indexed condition is counted twice in table's fanout
MDEV-5984: EITS: Incorrect filtered% value for single-table select with range access
- Fix calculate_cond_selectivity_for_table() to work correctly with range accesses 
  over multi-component keys:
  = First, take selectivity of all possible range scans into account. Remember which 
    fields were used bt the range scans.
  = Then, calculate selectivity produced by sargable predicates on fields. If a 
    field was used in a possible range access, assume its selectivity is already
    taken into account.
- Fix table_cond_selectivity(): when quick select is used, selectivity of
  COND(table) is taken into account in matching_candidates_in_table(). In
  table_cond_selectivity() we should not apply it for the second time.
2014-04-01 09:59:51 -07:00
Igor Babaev
887a210ffc Fixed bug mdev-5931.
After constant table row substitution the where condition may be converted
to always true. The function calculate_cond_selectivity_for_table() should
take into account this possibility.
2014-03-22 12:44:39 -07:00
Sergey Petrunya
365ba070fe MDEV-5814: MySQL Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
- Adopt MySQL's fix: don't run index_merge optimizer if the table statistics 
  reports that the table has 0 rows.
2014-03-14 18:52:16 +01:00
Sergei Golubchik
4c788b06d4 10.0-base merge 2014-03-05 23:20:10 +01:00
Sergei Golubchik
99316b51b6 compilation failure with BUILD/compile-amd64-valgrind-max 2014-03-26 08:24:19 +01:00
Sergei Golubchik
21a17536c6 5.3 merge 2014-03-25 11:09:12 +01:00
unknown
2eb920b262 Fix to make it compiling with valgrind. 2014-03-21 12:23:09 +02:00
Sergei Golubchik
5d0c01608c 5.2 merge 2014-03-16 21:03:01 +01:00
Sergei Golubchik
e772cbd7b7 5.1 merge 2014-03-16 13:59:44 +01:00
Sergei Golubchik
d7304375e5 mysql-5.1.73 merge 2014-03-15 18:24:15 +01:00
Igor Babaev
1a536c8daf Fixed bug mdev-5635.
After constant row substitution some field items become constant items.
The range analyzer should take into account this fact when looking for
ranges.
2014-02-27 13:54:05 -08:00
Sergei Golubchik
0dc23679c8 10.0-base merge 2014-02-26 15:28:07 +01:00
Sergey Petrunya
c397f97407 MDEV-5732: Valgrind warning for index_merge and extended_keys
- Make is_key_scan_ror() take into account the existence of extended keys.
2014-02-25 19:25:49 +04:00
Sergey Petrunya
6ebaa4939e Backport the following from 5.5 to 5.3:
MDEV-4556 Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX
- merge_same_index_scans() may put the same SEL_ARG tree in multiple result plans.
  make it call incr_refs() on the SEL_ARG trees that it does key_or() on, because 
  key_or(sel_arg_tree_1, sel_arg_tree_2) call may invalidate SEL_ARG trees pointed 
  by sel_arg_tree_1 and sel_arg_tree_2.
2014-02-19 18:34:12 +04: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
2f22e85d05 Backport from 10.0 to 10.0-base the following:
revision-id: psergey@askmonty.org-20140204092710-2yt5ysa5ej3l2c03
MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not
Port to mariadb-1.0 the following fix from mysql-5.6:
      
Revision ID: jorgen.loland@oracle.com-20120314131055-ml54x9deueqfsff4
BUG#13701206: WHERE A>=B DOES NOT GIVE SAME EXECUTION PLAN
              AS WHERE B<=A (RANGE OPTIMIZER)
       
that fix didn't have a public testcase, so I created one.
2014-02-12 21:37:58 +04:00
Igor Babaev
80a38b92d4 Fixed bug mdev-5630.
The function calculate_cond_selectivity_for_table() must consider
the case when the key range tree returned by the call of get_mm_tree()
is of the type SEL_TREE::ALWAYS.
2014-02-11 19:22:17 -08:00
Michael Widenius
10001c8e4f Automatic merge 2014-02-05 19:23:11 +02:00
Sergei Golubchik
5475cc7765 merge 2014-02-04 10:49:44 +01:00
Sergey Petrunya
75a3527777 MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not
Port to mariadb-1.0 the following fix from mysql-5.6:

  Revision ID: jorgen.loland@oracle.com-20120314131055-ml54x9deueqfsff4
  BUG#13701206: WHERE A>=B DOES NOT GIVE SAME EXECUTION PLAN
                AS WHERE B<=A (RANGE OPTIMIZER)
 
that fix didn't have a public testcase, so I created one.
2014-02-04 13:27:10 +04:00
Sergei Golubchik
72c20282db 10.0-base merge 2014-02-03 15:22:39 +01:00
Sergei Golubchik
59d9d08e2b 5.5 merge 2014-02-01 00:54:03 +01:00
Sergei Golubchik
37d240ecf9 MySQL-5.5.35 merge 2014-01-22 15:29:36 +01:00
Michael Widenius
273078c5fa Fixes to get valgrind to work with jemalloc
- Added MALLOC_LIBRARY variable to hold name of malloc library
- Back ported valgrind related fixes from jemalloc 3.4.1 to the included jemalloc 3.3.1
- Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free() to avoid clash with jemalloc 3.4.1
- Use option --soname-synonyms=somalloc=NON to valgrind when using jemalloc
- Show version related variables in mysqld --help
  -- Added SHOW_VALUE_IN_HELP marker

Increased back_log to 150 as the original value was a bit too small


CMakeLists.txt:
  Added MALLOC_LIBRARY variable to hold name of malloc library
cmake/jemalloc.cmake:
  Added MALLOC_LIBRARY variable to hold name of malloc library
config.h.cmake:
  Added MALLOC_LIBRARY variable to hold name of malloc library
extra/jemalloc/ChangeLog:
  Updates changelog
extra/jemalloc/include/jemalloc/internal/arena.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/private_namespace.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/tcache.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/src/arena.c:
  Backported valgrind fixes from jemalloc 3.4.1
include/my_bitmap.h:
  Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free() to avoid clash with jemalloc 3.4.1
mysql-test/mysql-test-run.pl:
  Use option --soname-synonyms=somalloc=NON to valgrind when using jemalloc
mysql-test/valgrind.supp:
  Supression of memory leak in OpenSuse 12.3
mysys/my_bitmap.c:
  Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free()
sql/ha_ndbcluster_binlog.cc:
  Renames
sql/ha_ndbcluster_cond.h:
  Renames
sql/ha_partition.cc:
  Renames
sql/handler.cc:
  Renames
sql/item_subselect.cc:
  Renames
sql/log_event.cc:
  Renames
sql/log_event_old.cc:
  Renames
sql/mysqld.cc:
  Renames
  Show version related variables in mysqld --help
sql/opt_range.cc:
  Renames
sql/opt_table_elimination.cc:
  Renames
sql/partition_info.cc:
  Renames
sql/rpl_injector.h:
  Renames
sql/set_var.h:
  Renames
sql/slave.cc:
  Renames
sql/sql_bitmap.h:
  Renames
sql/sql_insert.cc:
  Renames
sql/sql_lex.h:
  Renames
sql/sql_parse.cc:
  Renames
sql/sql_partition.cc:
  Renames
sql/sql_select.cc:
  Renames
sql/sql_show.cc:
  Renames
sql/sql_update.cc:
  Renames
sql/sys_vars.cc:
  Show version related variables in mysqld --help
sql/sys_vars.h:
  Added SHOW_VALUE_IN_HELP marker for variables that should be shown in --help
sql/table.cc:
  Renames
sql/table.h:
  Removed not used bitmap_init_value
storage/connect/ha_connect.cc:
  Removed compiler warning
storage/maria/ma_open.c:
  Renames
unittest/mysys/bitmap-t.c:
  Renames
2014-01-02 11:19:19 +02:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Igor Babaev
8efaff4959 Fixed bug mdev-5415.
Do not calculate selectivity of conditions for the tables of the information schema.
2013-12-14 19:13:37 -08:00
Sergei Golubchik
c6d30805db 5.5 merge 2013-11-23 00:50:54 +01:00
Sergey Petrunya
bc956c0046 MDEV-5069: Server crashes in SEL_ARG::increment_use_count with index_merge+index_merge_sort_union, FORCE INDEX
- Don't call incr_refs() is the merged SEL_ARG* is NULL.
2013-11-19 13:47:35 +04: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
69e6a2bb22 MDEV-3798: EXPLAIN UPDATE/DELETE
- Update test results after last few csets
- Generate correct value for `possible_keys` column for single table UPDATE/DELETE.
2013-10-08 16:13:49 +04:00
Sergey Petrunya
69393db3d1 MDEV-3798: EXPLAIN UPDATE/DELETE
- Better EXPLAIN-saving methods for quick selects
2013-10-07 13:58:47 +04:00
Sergey Petrunya
e5d13c1567 Merge 10.0-base -> 10.0 2013-10-16 13:38:42 +04:00
Sergey Petrunya
72bc6d7364 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: more renames
2013-10-05 13:19:45 +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
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