Commit graph

48 commits

Author SHA1 Message Date
Oleksandr Byelkin
e3982cead2 MDEV-6066: Merge new defaults from 5.6 and 5.7 (defaults changed, QC can be stopped with no-zero size) 2015-09-04 10:33:56 +02:00
Igor Babaev
587c72088c Fixed bug mdev-7316.
The function table_cond_selectivity() should take into account that condition selectivity
for some fields can be set to 0.
2015-02-05 20:09:08 -08:00
Sergey Petrunya
9578a332a2 Fix buildbot failure: make selectivity.test and selectivity_innodb.test work when
table names are case-insensitive.
2014-11-11 19:59:31 +03:00
Igor Babaev
100b10d8ef Fixed bug mdev-6843.
The function  get_column_range_cardinality() returned a wrong result for any column
containing only null values.
2014-10-28 22:31:52 -07:00
Igor Babaev
592b7fbac9 Fixed bug mdev-6325.
Field::selectivity should be set for all fields used in range conditions.
2014-10-28 14:33:31 -07:00
unknown
4cd676cbd9 MDEV-6047: Make exists_to_in optimization ON by default 2014-06-09 13:42:21 +03:00
Sergey Petrunya
92e49bb066 MDEV-4360: ANALYZE shows "Table is already up to date" while updating stats
- Show a line with "Engine-independent statistics collected" when ANALYZE command
  caused EITS statistics to be recollected.
2014-03-28 00:32:53 +04:00
Sergey Petrunya
79a8a6130b Code cleanup:
- Move [some] engine-agnostic tests from t/selectivity.test to t/selectivity_no_engine.test
- Move Histogram::point_selectivity to sql_statistics.cc
2014-03-27 13:08:00 +04:00
Sergey Petrunya
0d67aafaa2 Merge 2014-03-27 12:37:05 +04:00
Sergey Petrunya
ab061a2bb3 MDEV-5926, MDEV-4362 post-fixes:
- Histogram::find_bucket() should not walk off the end of the value range.
- Address review feedback in Histogram::point_selectivity(): different handling
  for zero-width buckets, and explanations.
2014-03-27 12:30:49 +04:00
Sergey Petrunya
dee11f9633 MDEV-4362: {division by zero when lookup constant is outside the value table}
- Fix Histogram::point_selectivity() to work in the case where the 
  passed value_pos=0 (or 1) and the first (or the last) bucket in the 
  histogram has zero value-range (i.e one value).
2014-03-26 21:05:31 +04:00
Sergey Petrunya
ad842b5f05 MDEV-5926: EITS: Histogram estimates for column=least_possible_value are wrong
[Attempt #2]
- Use a new selectivity calculation formula in Histogram::point_selectivity. 
  The formula is different from the old one because it was developed from scratch.
  it doesn't have any possible division-by-zero problems.
2014-03-26 17:55:00 +04:00
Sergey Petrunya
0e211841f2 MDEV-5917: EITS: different order of predicates in IN (...) causes different estimates
- Save range key before making field->pos_in_interval() call (like we do for non-equality ranges)
2014-03-21 00:53:41 +04:00
Igor Babaev
d51ee6d412 Merge. 2014-03-19 14:58:29 -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
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
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
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
Igor Babaev
acc539a2c4 Added the test case for bug mdev-5200.
The bug was fixed by the patch applied to the 5.3 tree in the revision 3727.
2013-11-26 15:04:21 -08:00
Sergey Petrunya
e5d13c1567 Merge 10.0-base -> 10.0 2013-10-16 13:38:42 +04:00
Igor Babaev
f6b65232c7 Fixed bug mdev-4429: fixed another place where selectivity == 0 requires
a special handling.
2013-09-30 17:42:18 -07: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
Igor Babaev
09a1f410cb Fixed bug mdev-4406.
This bug in the code of get_column_range_cardinality() could lead to
wrong estimates of number of records in ranges for non-nullable columns.
2013-04-20 02:16:55 -07:00
unknown
9441e53653 MDEV-4345
Sampling of selectivity of LIKE predicate.
2013-04-18 22:22:04 +03:00
Igor Babaev
ac8333e46d Fixed a typo/bug that could lead to wrong selectivity numbers for
tables retrieved by range scans.

Added comments forgotten in the previous patch.
2013-04-17 16:15:22 -07:00
Igor Babaev
f3bbd40349 Fixed bug mdev-4389.
The selectivity of a range degenerated into a point never should be set to 0.
2013-04-12 02:47:46 -07:00
Igor Babaev
1db675b6e8 Fixed mdev-4380.
Uninitialized field next_equal_field of the Field objects created
for the fields of a temporary table could hang the server.
2013-04-08 21:30:42 -07:00
Igor Babaev
ddb84f909c Fixed mdev-4378.
Uninitialized field cond_selectivity of the Field objects created
for the fields of a temporary table could cause an assertion abort.
2013-04-08 17:40:58 -07:00
Igor Babaev
e3bf08d4b1 Fixed bug mdev-4363.
When calculating the selectivity of a range in the function
get_column_range_cardinality a check whether NULL values are
included into into the range must be done.
2013-04-06 17:18:51 -07:00
Igor Babaev
1c30fb2a15 Fixed bug mdev-4372.
Range analysis of non-indexed columns should handle properly range trees
with type == SEL_TREE::MAYBE.
2013-04-06 12:33:38 -07:00
Igor Babaev
b2d0a33ea0 Fixed bug mdev-4373:
Valgrind complained on usage of uninitialized memory.
2013-04-06 00:51:41 -07:00
Igor Babaev
1ae352afbe Fixed bugs mdev-4357 and mdev-4359.
The values of the column HIST_TYPE from the statistical table
mysql.column_stats were stored in the table and read from the
table incorrectly.
2013-04-05 23:48:49 -07:00
Igor Babaev
503731d80f Fixed bug mdev-4371.
Avoid possible division by 0.
2013-04-05 13:01:46 -07:00
Igor Babaev
daaa5834c9 Fixed bug mdev-4370.
Don't try to a histogram if it is not read into the cache for statistical data.
It may happen so if optimizer_use_condition_selectivity is set to 3. This 
setting orders the optimizer not use histograms to calculate selectivity.
2013-04-05 11:24:28 -07:00
Igor Babaev
4079a5dc3f Fixed bug mdev-4366.
When performing the range analysis for a conjunction the function
calculate_cond_selectivity_for_table should take in to account that
the analysis of some conjuncts may return SEL_ARG::IMPOSSIBLE.
2013-04-04 14:11:31 -07:00
Igor Babaev
50d4d1ca18 Fixed bug mdev-4367.
When calculating selectivity of conditions one should take into account
the cases when some tables to be joined are empty.
2013-04-03 23:50:14 -07:00
Igor Babaev
d62ee4e970 Fixed bug mdev-4350.
Wrong formulas used by the function Histogram::point_selectivity()
could result in a negative value of selectivity returned by the
function.
2013-04-03 20:00:10 -07:00
Igor Babaev
915a8ae42c Fixed bug mdev-4349.
Range analysis of the condition for a non-indexed column may
return an impossible range. This must be taken into account.
2013-04-03 00:54:24 -07:00
Igor Babaev
70badba5e0 Fixed bug mdev-4348.
The bug was caused a wrong casting.
2013-04-01 20:49:20 -07:00
Igor Babaev
e370530493 Take into account the number of null values in any used column when
calculating selectivity of conditions.
2013-03-31 23:41:47 -07:00
Igor Babaev
2713bab291 Merge 10.0-base -> mwl253. 2013-03-31 09:10:01 -07:00
Igor Babaev
78bab78395 Merge 2013-03-30 22:00:04 -07:00
Igor Babaev
9e1ca1053b Added the type of histogram for mwl #253.
Introduced double precision height-balanced histograms.
2013-03-30 18:57:07 -07:00
Igor Babaev
9055498634 Fixed several bugs for mwl #253.
One of them is quite serious: the function table_cond_selectivity used
the TABLE_REF structure for ref/eq_ref access methods as if they had been
filled. In  fact these structure are filled after the best execution plan
has been chosen.

The other bugs happened due to:
- an erroneous attempt at get statistics on the result of materialization
  of a view
- incorrect handling of ranges with no left/right limits when calculating
  selectivity of range conditions on non-indexed columns
- lack of cleanup for some newly introduced fields
2013-03-30 15:37:21 -07:00
Igor Babaev
1009832c13 Added histogams for table columns. 2013-03-25 23:48:29 -07:00
Igor Babaev
fc1c8ffdad The pilot patch for mwl#253. 2013-03-11 07:44:24 -07:00