Commit graph

136 commits

Author SHA1 Message Date
Martin Hansson
41cfa3e769 Bug#54444: Do not run main.range test for products without partitioning
feature

The test for bug no 50939 was put in range.test which isn't such a good idea
since it requires partitioning. Fixed by moving the test case to
partitioning_range.test.
2010-08-11 14:13:59 +02:00
Martin Hansson
6d0425b18d Bug#50939: Loose Index Scan unduly relies on engine to
remember range endpoints

The Loose Index Scan optimization keeps track of a sequence
of intervals. For the current interval it maintains the
current interval's endpoints. But the maximum endpoint was
not stored in the SQL layer; rather, it relied on the
storage engine to retain this value in-between reads. By
coincidence this holds for MyISAM and InnoDB. Not for the
partitioning engine, however.

Fixed by making the key values iterator 
(QUICK_RANGE_SELECT) keep track of the current maximum endpoint.
This is also more efficient as we save a call through the
handler API in case of open-ended intervals.

The code to calculate endpoints was extracted into 
separate methods in QUICK_RANGE_SELECT, and it was possible to
get rid of some code duplication as part of fix.
2010-05-10 09:23:23 +02:00
Martin Hansson
14f2eb1244 Bug#48459: valgrind errors with query using 'Range checked
for each record'

There was an error in an internal structure in the range
optimizer (SEL_ARG). Bad design causes parts of a data
structure not to be initialized when it is in a certain
state. All client code must check that this state is not
present before trying to access the structure's data. Fixed
by

- Checking the state before trying to access data (in
several places, most of which not covered by test case.)

- Copying the keypart id when cloning SEL_ARGs


mysql-test/r/range.result:
  Bug#48459: Test result.
mysql-test/t/range.test:
  Bug#48459: Test case.
sql/opt_range.cc:
  Bug#48459: Fix + doxygenated count_key_part_usage comment.
2009-11-25 11:02:25 +01:00
Georgi Kodinov
405c9310cf Bug #48665: sql-bench's insert test fails due to wrong result
When merging ranges during calculation of the result of OR
to two range sets the current range may be obsoleted by the 
resulting merged range.
The first overlapping range can be obsoleted as well.

Fixed by moving the pointer to the first overlapping range to the
pointer of the resulting union range.
Added few comments at key places in key_or().
2009-11-19 18:26:19 +02:00
Martin Hansson
740b7c4e36 Bug#47925: regression of range optimizer and date comparison in 5.1.39!
When a query was using a DATE or DATETIME value formatted
using any other separator characters beside hyphen '-', a
query with a greater-or-equal '>=' condition matching only
the greatest value in an indexed column, the result was
empty if index range scan was employed.

The range optimizer got a new feature between 5.1.38 and
5.1.39 that changes a greater-or-equal condition to a
greater-than if the value matching that in the query was not
present in the table. But the value comparison function
compared the dates as strings instead of dates.

The bug was fixed by splitting the function
get_date_from_str in two: One part that parses and does
error checking. This function is now visible outside the
module. The old get_date_from_str now calls the new
function.


mysql-test/r/range.result:
  Bug#47925: Test result
mysql-test/t/range.test:
  Bug#47925: Test case
sql/item.cc:
  Bug#47925: Fix + some edit on the comments
sql/item.h:
  Bug#47925: Changed function signature
sql/item_cmpfunc.cc:
  Bug#47925: Split function in two
sql/item_cmpfunc.h:
  Bug#47925: Declaration of new function
sql/opt_range.cc:
  Bug#47925: Added THD to function call
sql/time.cc:
  Bug#47925: Added microsecond comparison
2009-11-02 13:24:07 +01:00
Alexey Kopytov
f6868a4eb4 Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
The problem was in incorrect handling of predicates involving 
NULL as a constant value by the range optimizer. 
 
For example, when creating a SEL_ARG node from a condition of 
the form "field < const" (which would normally result in the 
"NULL < field < const" SEL_ARG),  the special case when "const" 
is NULL was not taken into account, so "NULL < field < NULL" 
was produced for the "field < NULL" condition. 
 
As a result, SEL_ARG structures of this form could not be 
further optimized which in turn could lead to incorrectly 
constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
structures to always form a sequence of ordered disjoint 
intervals could enter an infinite loop under some 
circumstances. 
 
Fixed by changing get_mm_leaf() so that for any sargable 
predicate except "<=>" involving NULL as a constant, "empty" 
SEL_ARG is returned, since such a predicate is always false. 

mysql-test/r/partition_pruning.result:
  Fixed a broken test case.
mysql-test/r/range.result:
  Added a test case for bug #47123.
mysql-test/r/subselect.result:
  Fixed a broken test cases.
mysql-test/t/range.test:
  Added a test case for bug #47123.
sql/opt_range.cc:
  Fixed get_mm_leaf() so that for any sargable
  predicate except "<=>" involving NULL as a constant, "empty"
  SEL_ARG is returned, since such a predicate is always false.
2009-10-17 00:19:51 +04:00
Georgi Kodinov
d80e35f26f Revert the fix for bug #47123 until test suite failures are resolved. 2009-10-16 11:42:16 +03:00
Alexey Kopytov
79406bc49a Manual merge. 2009-10-15 14:42:51 +04:00
Alexey Kopytov
bc9f56a6c2 Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
The problem was in incorrect handling of predicates involving 
NULL as a constant value by the range optimizer.  
 
For example, when creating a SEL_ARG node from a condition of 
the form "field < const" (which would normally result in the 
"NULL < field < const" SEL_ARG),  the special case when "const" 
is NULL was not taken into account, so "NULL < field < NULL" 
was produced for the "field < NULL" condition. 
 
As a result, SEL_ARG structures of this form could not be 
further optimized which in turn could lead to incorrectly 
constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
structures to always form a sequence of ordered disjoint 
intervals could enter an infinite loop under some 
circumstances. 
 
Fixed by changing get_mm_leaf() so that for any sargable 
predicate except "<=>" involving NULL as a constant, "empty" 
SEL_ARG is returned, since such a predicate is always false. 

mysql-test/r/range.result:
  Added a test case for bug #47123.
mysql-test/t/range.test:
  Added a test case for bug #47123.
sql/opt_range.cc:
  Fixed get_mm_leaf() so that for any sargable 
  predicate except "<=>" involving NULL as a constant, "empty" 
  SEL_ARG is returned, since such a predicate is always false.
2009-10-13 19:49:32 +04:00
Martin Hansson
5ef9ec9d9e Bug#42846: wrong result returned for range scan when using
covering index
      
When two range predicates were combined under an OR
predicate, the algorithm tried to merge overlapping ranges
into one. But the case when a range overlapped several other
ranges was not handled. This lead to

1) ranges overlapping, which gave repeated results and 
2) a range that overlapped several other ranges was cut off.  

Fixed by 

1) Making sure that a range got an upper bound equal to the
next range with a greater minimum.
2) Removing a continue statement


mysql-test/r/group_min_max.result:
  Bug#42846: Changed query plans
mysql-test/r/range.result:
  Bug#42846: Test result.
mysql-test/t/range.test:
  Bug#42846: Test case.
sql/opt_range.cc:
  Bug#42846: The fix. 
  
  Part1: Previously, both endpoints from key2 were copied,
  which is not safe. Since ranges are processed in ascending
  order of minimum endpoints, it is safe to copy the minimum
  endpoint from key2 but not the maximum. The maximum may only
  be copied if there is no other range or the other range's
  minimum is greater than key2's maximum.
2009-10-09 11:30:40 +02:00
unknown
548b389f3a Merge mysql.com:/misc/mysql/34731/50-34731
into  mysql.com:/misc/mysql/34731/51-34731


mysql-test/t/range.test:
  Auto merged
sql/opt_range.cc:
  Auto merged
mysql-test/r/range.result:
  manual merge
2008-03-27 03:18:46 +01:00
unknown
fd1616311d Merge mysql.com:/misc/mysql/34731_/50-34731
into  mysql.com:/misc/mysql/34731/50-34731


sql/opt_range.cc:
  Auto merged
mysql-test/r/range.result:
  manual merge
mysql-test/t/range.test:
  manual merge
2008-03-27 03:16:35 +01:00
unknown
ec62aba3f0 Bug#34731: highest possible value for INT erroneously filtered by WHERE
WHERE f1 < n ignored row if f1 was indexed integer column and
f1 = TYPE_MAX ^ n = TYPE_MAX+1. The latter value when treated
as TYPE overflowed (obviously). This was not handled, it is now.


mysql-test/r/range.result:
  show that on an index int column, we no longer disregard
  a field val of TYPE_MAX in SELECT ... WHERE ... < TYPE_MAX+1
mysql-test/t/range.test:
  show that on an index int column, we no longer disregard
  a field val of TYPE_MAX in SELECT ... WHERE ... < TYPE_MAX+1
sql/opt_range.cc:
  Handle overflowing of int-types in range-optimizer.
  Unfortunately requires re-indentation of entire block.
  Overflow (err == 1) was handled, but only if
  field->cmp_type() != value->result_type(), which it
  just wasn't in our case.
2008-03-10 11:12:12 +01:00
unknown
3d35b0199e Post-merge fixes. 2008-02-13 21:57:50 +03:00
unknown
9112390314 Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.1-opt


mysql-test/r/heap.result:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
BitKeeper/deleted/.del-bdb.result:
  Auto merged
mysql-test/r/strict.result:
  Auto merged
mysql-test/r/type_binary.result:
  Auto merged
mysql-test/r/type_set.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/r/warnings.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysql-test/t/warnings.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/mysqld.cc:
  Null merge.
mysql-test/include/mix1.inc:
  Manual merge.
mysql-test/r/innodb_mysql.result:
  Manual merge.
mysql-test/r/range.result:
  Manual merge.
mysql-test/r/sp.result:
  Manual merge.
mysql-test/t/sp.test:
  Manual merge.
sql/handler.cc:
  Manual merge.
2008-02-13 12:12:00 +03:00
unknown
e30a0dda8f Fixed bug #33833.
Two disjuncts containing equalities of the form key=const1 and key=const2 can
be merged into one if const1 is equal to const2. To check it the common 
collation of the constants were used rather than the collation of the field key.
For example when the default collation of the constants was cases insensitive
while the collation of the field was case sensitive, then two or-ed equality 
predicates key='b' and key='B' incorrectly were merged into one f='b'. As a 
result ref access was used instead of range access and wrong result sets were 
returned in many cases. 
Fixed the problem by comparing constant in the or-ed predicate with collation of
the key field.


mysql-test/r/range.result:
  Added a test case for bug #33833.
mysql-test/t/range.test:
  Added a test case for bug #33833.
sql/item.cc:
  Fixed bug #33833.
  Added the method eq_by_collation that compares two items almost as 
  the method Item::eq, but it rather enforces a given collation for
  the comparison.
sql/item.h:
  Fixed bug #33833.
  Added the method eq_by_collation that compares two items almost as 
  the method Item::eq, but it rather enforces a given collation for
  the comparison.
2008-01-26 21:45:35 -08:00
unknown
f7f96cd28d after merge fix 2007-12-13 16:43:38 +04:00
unknown
214ea2063a Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
include/mysql_com.h:
  Auto merged
libmysql/CMakeLists.txt:
  Auto merged
mysql-test/r/delayed.result:
  Auto merged
mysql-test/r/func_misc.result:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/r/ps.result:
  Auto merged
mysql-test/t/func_misc.test:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/mi_check.c:
  Auto merged
mysql-test/include/mix1.inc:
  manual merge
mysql-test/r/innodb_mysql.result:
  manual merge
mysql-test/r/range.result:
  manual merge
sql/item_cmpfunc.cc:
  manual merge
2007-12-13 16:10:57 +04:00
unknown
c6675cd187 BUG#32198: Comparison of DATE with DATETIME still not using indexes correctly
- Make conditions like "date_col $CMP$ 'datetime-const'" range-sargable


mysql-test/r/range.result:
  BUG#32198: Comparison of DATE with DATETIME still not using indexes correctly
  - Testcase
mysql-test/t/range.test:
  BUG#32198: Comparison of DATE with DATETIME still not using indexes correctly
  - Testcase
sql/field.cc:
  BUG#32198: Comparison of DATE with DATETIME still not using indexes correctly
  - Added comments
2007-12-13 13:38:22 +03:00
unknown
aff34a8c64 Bug #27531: 5.1 part of the fix
- Renamed "Using join cache" to "Using join buffer".
- "Using join buffer" is now printed on the last
  table that "reads" from the join buffer cache.


mysql-test/r/archive_gis.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/compress.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/ctype_utf8.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/derived.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/distinct.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/func_group.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/func_group_innodb.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/gis.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/greedy_optimizer.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/group_by.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/group_min_max.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/index_merge_myisam.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/information_schema.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/innodb_gis.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/innodb_mysql.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/join.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/join_nested.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/key_diff.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/myisam.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/ndb_condition_pushdown.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/ndb_gis.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/range.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/row.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/select.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/ssl.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/ssl_compress.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/subselect.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/subselect3.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/union.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
mysql-test/r/view.result:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
sql/sql_select.cc:
  Bug #27531: renamed "Using join cache" to "Using join buffer"
  and moved to the last table in the batch.
2007-05-29 15:58:18 +03:00
unknown
0c835da803 bug #27531: 5.1 part of the fix:
- added join cache indication in EXPLAIN (Extra column).
 - prefer filesort over full scan over 
   index for ORDER BY (because it's faster).
 - when switching from REF to RANGE because
   RANGE uses longer key turn off sort on
   the head table only as the resulting 
   RANGE access is a candidate for join cache
   and we don't want to disable it by sorting
   on the first table only. 


mysql-test/r/archive_gis.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/compress.result:
  bug #27531:
   - join cache in EXPLAIN. 
   - prefer filesort over full scan over index for ORDER BY.
mysql-test/r/ctype_utf8.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/derived.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/distinct.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/func_group.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/func_group_innodb.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/gis.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/greedy_optimizer.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/group_by.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/group_min_max.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/index_merge_myisam.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/information_schema.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/innodb_gis.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/innodb_mysql.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/join.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/join_nested.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/key_diff.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/myisam.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/ndb_condition_pushdown.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/ndb_gis.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/range.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/row.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/select.result:
  bug #27531:
   - join cache in EXPLAIN.
   - prefer filesort over full scan over index for ORDER BY.
mysql-test/r/ssl.result:
  bug #27531:
   - join cache in EXPLAIN.
   - prefer filesort over full scan over index for ORDER BY.
mysql-test/r/ssl_compress.result:
  bug #27531:
   - join cache in EXPLAIN.
   - prefer filesort over full scan over index for ORDER BY.
mysql-test/r/subselect.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/subselect3.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/union.result:
  bug #27531: join cache in EXPLAIN
mysql-test/r/view.result:
  bug #27531: join cache in EXPLAIN
sql/sql_select.cc:
  bug #27531:
   - join cache in EXPLAIN.
   - prefer filesort over full scan over
     index for ORDER BY.
   - disable sorting on the first table only
     when switching from REF to RANGE.
2007-05-04 18:06:06 +03:00
unknown
fd4dbbf5be Merge mysql.com:/home/psergey/bk-trees/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.1-merge2


mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
sql/opt_range.cc:
  Auto merged
2007-03-31 03:12:33 +04:00
unknown
2016b21ce1 BUG#26624, pushbuild fixes: Merge to 5.0
mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
2007-03-31 00:48:31 +04:00
unknown
080c0c7ac8 BUG#26624: high mem usage (crash) in range optimizer
Pushbuild fixes: 
 - Make MAX_SEL_ARGS smaller (even 16K records_in_range() calls is 
   more than it makes sense to do in typical cases)
 - Don't call sel_arg->test_use_count() if we've already allocated 
   more than MAX_SEL_ARGs elements. The test will succeed but will take
   too much time for the test suite (and not provide much value).


mysql-test/r/range.result:
  BUG#26624: high mem usage (crash) in range optimizer
  Pushbuild fixes: make the test go faster
mysql-test/t/range.test:
  BUG#26624: high mem usage (crash) in range optimizer
  Pushbuild fixes: make the test go faster
2007-03-31 00:29:18 +04:00
unknown
94069acc2f Merge mysql.com:/home/psergey/mysql-5.0-merge
into  mysql.com:/home/psergey/mysql-5.1-merge


BitKeeper/deleted/.del-mysqld.cc.rej:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_list.h:
  Auto merged
mysql-test/r/subselect.result:
  Manual merge
mysql-test/t/subselect.test:
  Manual merge
sql/opt_range.cc:
  Manual merge
2007-03-29 12:24:23 +04:00
unknown
bedd5b8766 Merge of BUG#26624 and BUG#26625
mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
2007-03-29 10:35:28 +04:00
unknown
9639eb3dda BUG#26624: high mem usage (crash) in range optimizer
- Added PARAM::alloced_sel_args where we count the # of SEL_ARGs
  created by SEL_ARG tree cloning operations.
- Made the range analyzer to shortcut and not do any more cloning 
  if we've already created MAX_SEL_ARGS SEL_ARG objects in cloning.
- Added comments about space complexity of SEL_ARG-graph 
  representation.


mysql-test/r/range.result:
  BUG#26624: Testcase
mysql-test/t/range.test:
  BUG#26624: Testcase
2007-03-28 20:16:01 +04:00
unknown
659a1255af Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint


configure.in:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
2007-01-31 16:23:10 -05:00
unknown
d663a34303 Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt


BitKeeper/etc/ignore:
  auto-union
mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/sp-code.result:
  Auto merged
mysql-test/r/trigger.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/select.result:
  manual merge
mysql-test/r/view.result:
  manual merge
mysql-test/t/select.test:
  manual merge
mysql-test/t/view.test:
  manual merge
2007-01-24 19:54:40 +04:00
unknown
6098f77078 merge of 5.0-opt -> 5.1-opt 2007-01-24 15:55:16 +02:00
unknown
276f0d4c5e Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt


mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/sp-code.result:
  Auto merged
mysql-test/r/trigger.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
mysql-test/t/udf.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
mysql-test/r/func_str.result:
  merge 5.0-opt -> 5.1-opt
mysql-test/r/group_by.result:
  merge 5.0-opt -> 5.1-opt
mysql-test/r/insert.result:
  merge 5.0-opt -> 5.1-opt
mysql-test/r/subselect.result:
  merge 5.0-opt -> 5.1-opt
mysql-test/t/group_by.test:
  merge 5.0-opt -> 5.1-opt
mysql-test/t/insert.test:
  merge 5.0-opt -> 5.1-opt
mysql-test/t/subselect.test:
  merge 5.0-opt -> 5.1-opt
mysql-test/t/view.test:
  merge 5.0-opt -> 5.1-opt
sql/item_cmpfunc.h:
  merge 5.0-opt -> 5.1-opt
sql/item_strfunc.h:
  merge 5.0-opt -> 5.1-opt
2007-01-23 12:34:50 +02:00
unknown
acef88bee3 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt


mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/sp-code.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/select.result:
  manual merge
mysql-test/r/view.result:
  manual merge
mysql-test/t/select.test:
  manual merge
2007-01-23 14:08:58 +04:00
unknown
7f5bcdaaa5 after merge fix.
mysql-test/r/range.result:
  Fix for bug #22533: Traditional: Too-long bit value not rejected.
    - results adjusted.
2007-01-19 12:19:53 +04:00
unknown
29d9e91478 Merge mysql.com:/usr/home/ram/work/bug22533/my50-bug22533
into  mysql.com:/usr/home/ram/work/bug22533/my51-bug22533


mysql-test/r/range.result:
  Auto merged
mysql-test/r/type_bit.result:
  Auto merged
mysql-test/r/type_bit_innodb.result:
  Auto merged
sql/field.cc:
  Auto merged
2007-01-18 15:59:40 +04:00
unknown
368d6b2794 after merge fix. 2007-01-18 15:28:45 +04:00
unknown
759a028c20 Adjusted results after merge 4.1 -> 5.0 for the patch fixing bug 24776. 2007-01-15 14:01:36 -08:00
unknown
8db06e6921 Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into  olga.mysql.com:/home/igor/mysql-5.0-opt


mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
sql/opt_range.h:
  Manual merge.
2007-01-15 10:14:09 -08:00
unknown
b9dc0243a8 Fixed bug #24776: an assertion abort in handler::ha_index_init
for queries using 'range checked for each record'.
The problem was fixed in 5.0 by the patch for bug 12291.
This patch down-ported the corresponding code from 5.0 into 
QUICK_SELECT::init() and added a new test case. 


mysql-test/r/range.result:
  Added a test case for bug #24776.
mysql-test/t/range.test:
  Added a test case for bug #24776.
sql/opt_range.h:
  Fixed bug #24776: an assertion abort in handler::ha_index_init
  for queries using 'range checked for each record'.
  The problem was fixed in 5.0 by the patch for bug 12291.
  The patch for 4.1 down-ported the corresponding code from 5.0 into 
  QUICK_SELECT::init().
2007-01-13 10:49:26 -08:00
unknown
e1a142961e Merge mysql.com:/usr/home/ram/work/bug20732/my50-bug20732
into  mysql.com:/usr/home/ram/work/bug20732/my51-bug20732


mysql-test/r/range.result:
  Auto merged
mysql-test/t/range.test:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/table.cc:
  manual merging.
2006-10-23 10:32:39 +05:00
unknown
68c2a008a1 Merge mysql.com:/usr/home/ram/work/bug20732/my41-bug20732
into  mysql.com:/usr/home/ram/work/bug20732/my50-bug20732


sql/opt_range.cc:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/table.cc:
  Auto merged
mysql-test/r/range.result:
  SCCS merged
mysql-test/t/range.test:
  SCCS merged
2006-10-19 16:15:30 +05:00
unknown
da7af481cd Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
We miss some records sometimes using RANGE method if we have
partial key segments.
Example:
  Create table t1(a char(2), key(a(1)));
  insert into t1 values ('a'), ('xx');
  select a from t1 where a > 'x';
We call index_read() passing 'x' key and HA_READ_AFTER_KEY flag
in the handler::read_range_first() wich is wrong because we have
a partial key segment for the field and might miss records like 'xx'.

Fix: don't use open segments in such a case.


mysql-test/r/range.result:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - test result.
mysql-test/t/range.test:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - test case.
sql/opt_range.cc:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - check if we have a partial key segment for a Item_func::GT_FUNC;
      if so, don't set NEAR_MIN flag in order to use HA_READ_KEY_OR_NEXT
      instead of HA_READ_AFTER_KEY.
sql/opt_range.h:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - key segment 'flag' slot added.
sql/sql_select.cc:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - test (HA_PART_KEY_SEG | HA_NULL_PART) as we split it in the sql/table.cc
sql/table.cc:
  Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
    - set HA_NULL_PART flag instead of HA_PART_KEY_SEG in order not to mix them.
2006-10-19 12:52:37 +05:00
unknown
d752b1a8da Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  mysql.com:/home/psergey/mysql-5.1-bug22393


mysql-test/t/range.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/range.result:
  Manual merge
2006-09-19 21:14:37 +04:00
unknown
5222b59093 Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/heap_hash.result:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/olap.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/row.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_date.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/r/view_grant.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/opt_sum.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_list.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/t/sp.test:
  SCCS merged
sql/item_cmpfunc.cc:
  SCCS merged
sql/sql_select.cc:
  SCCS merged
2006-09-18 12:57:20 +02:00
unknown
5e34af3240 BUG#22393: Very wrong E(#rows(ref(const)) for key with skewed distribution
- Check if we have E(#rows) for 'range' access on the smaller interval 
  on the same index. If yes, adjust the estimate.


mysql-test/r/range.result:
  BUG#22393: Testcase
mysql-test/t/range.test:
  BUG#22393: Testcase
2006-09-18 14:49:54 +04:00
unknown
fba86d2b7e Merge maint2.mysql.com:/data/localhome/tsmith/bk/mrg50/50
into  maint2.mysql.com:/data/localhome/tsmith/bk/mrg50/51


BUILD/SETUP.sh:
  Auto merged
client/Makefile.am:
  Auto merged
dbug/Makefile.am:
  Auto merged
include/mysql_com.h:
  Auto merged
libmysql/Makefile.am:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/lib/mtr_match.pl:
  Auto merged
mysql-test/lib/mtr_misc.pl:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/t/ctype_ucs.test:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/system_mysql_db_fix.test:
  Auto merged
mysys/my_seek.c:
  Auto merged
regex/Makefile.am:
  Auto merged
scripts/Makefile.am:
  Auto merged
server-tools/instance-manager/Makefile.am:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/slave.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_repl.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/stacktrace.c:
  Auto merged
sql-common/client.c:
  Auto merged
sql/stacktrace.h:
  Auto merged
storage/innobase/Makefile.am:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
tests/Makefile.am:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
BitKeeper/deleted/.del-mytest.c:
  Delete: libmysql/mytest.c
BitKeeper/deleted/.del-make_win_bin_dist:
  Delete: scripts/make_win_bin_dist
BitKeeper/deleted/.del-message.mc~1:
  Delete: sql/message.mc
Makefile.am:
  Manual merge (use local)
configure.in:
  Manual merge (use local)
BitKeeper/deleted/.del-Makefile.in:
  Manual merge (use local)
client/mysqlbinlog.cc:
  Manual merge (use local)
extra/Makefile.am:
  Manual merge (use local)
extra/comp_err.c:
  Manual merge (use local)
extra/yassl/Makefile.am:
  Manual merge (use local)
extra/yassl/taocrypt/Makefile.am:
  Manual merge (use local)
include/my_dbug.h:
  Manual merge (use local)
mysql-test/mysql-test-run.pl:
  Manual merge (use local)
mysql-test/lib/mtr_process.pl:
  Manual merge (use local)
mysys/Makefile.am:
  Manual merge (use local)
server-tools/Makefile.am:
  Manual merge (use local)
sql/Makefile.am:
  Manual merge (use local)
sql/sp.cc:
  Manual merge
sql/sp_head.cc:
  Manual merge
sql/sql_class.h:
  Manual merge (use local)
sql/sql_select.cc:
  SCCS merged
sql/table.cc:
  Manual merge
storage/archive/ha_archive.cc:
  Manual merge
storage/heap/Makefile.am:
  Manual merge (use local)
storage/myisam/Makefile.am:
  Manual merge (use local)
storage/myisammrg/Makefile.am:
  Manual merge (use local)
strings/Makefile.am:
  Manual merge (use local)
vio/Makefile.am:
  Manual merge (use local)
zlib/Makefile.am:
  Manual merge (use local)
2006-09-13 09:03:52 +02:00
unknown
22c3e7b4e1 Fixed bug #5500: EXPLAIN returned a wrong select_type for queries using views.
Select_type in the EXPLAIN output for the query SELECT * FROM t1 was
'SIMPLE', while for the query SELECT * FROM v1, where the view v1
was defined as SELECT * FROM t1, the EXPLAIN output contained 'PRIMARY'
for the select_type column.
 


mysql-test/r/group_by.result:
  Adjusted results after the fix for bug #5500.
mysql-test/r/information_schema.result:
  Adjusted results after the fix for bug #5500.
mysql-test/r/olap.result:
  Adjusted results after the fix for bug #5500.
mysql-test/r/range.result:
  Adjusted results after the fix for bug #5500.
mysql-test/r/view.result:
  Added a test case for bug #5500.
  Adjusted other results.
mysql-test/r/view_grant.result:
  Adjusted results after the fix for bug #5500.
mysql-test/t/view.test:
  Added a test case for bug #5500.
2006-09-06 08:21:43 -07:00
unknown
c4c36e17ac Fixed bug #16249: different results for a range with an without index
when a range condition use an invalid DATETIME constant.
Now we do not use invalid DATETIME constants to form end keys for
range intervals: range analysis just ignores predicates with such
constants.  


mysql-test/r/query_cache.result:
  Adjusted result warnings when adding a fix for bug #16249.
mysql-test/r/range.result:
  Added a test case for bug #16249.
mysql-test/t/range.test:
  Added a test case for bug #16249.
2006-08-31 07:27:34 -07:00
unknown
f57382196b Merge moonbone.local:/work/tmp_merge-5.0-mysql
into  moonbone.local:/work/tmp_merge-5.1-opt-mysql


BUILD/check-cpu:
  Auto merged
include/config-netware.h:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/ndb_condition_pushdown.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/r/user_var.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/range.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
storage/innobase/btr/btr0btr.c:
  Auto merged
storage/innobase/buf/buf0buf.c:
  Auto merged
storage/innobase/dict/dict0dict.c:
  Auto merged
storage/innobase/fil/fil0fil.c:
  Auto merged
storage/innobase/fsp/fsp0fsp.c:
  Auto merged
storage/innobase/include/buf0buf.ic:
  Auto merged
storage/innobase/log/log0log.c:
  Auto merged
storage/innobase/log/log0recv.c:
  Auto merged
storage/innobase/os/os0file.c:
  Auto merged
storage/innobase/row/row0sel.c:
  Auto merged
storage/innobase/srv/srv0start.c:
  Auto merged
storage/innobase/ut/ut0dbg.c:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
client/mysqltest.c:
  Manual merge
mysql-test/r/innodb_mysql.result:
  Manual merge
mysql-test/t/innodb_mysql.test:
  Manual merge
mysql-test/t/join_outer.test:
  Manual merge
sql/item_cmpfunc.cc:
  Manual merge
sql/mysql_priv.h:
  Manual merge
sql/opt_range.cc:
  Manual merge
sql/sql_base.cc:
  Manual merge
storage/innobase/include/btr0cur.ic:
  Manual merge
storage/innobase/row/row0mysql.c:
  Manual merge
2006-08-29 18:58:50 +04:00
unknown
c8cafde703 Fixed bug #18165.
Made [NOT]BETWEEN predicates SARGable in respect to the second and 
the third arguments.


mysql-test/r/range.result:
  Added a test case to bug #18165.
mysql-test/t/range.test:
  Added a test case to bug #18165.
sql/opt_range.cc:
  Fixed bug #18165.
  Made [NOT]BETWEEN predicates SARGable in respect to the second and 
  the third arguments.
  Put in a separate function called get_full_func_mm_tree the functionality
  that builds a conjunction of all SEL_TREEs for a simple predicate of the
  form (f op c), where f was a field and c was a constant, applying different
  equalities f=f' with f' being another field.
2006-08-16 09:37:19 -07:00
unknown
9cf4750ec3 BUG#21282: Incorrect query results for "t.key NOT IN (<big const list>)
In fix for BUG#15872, a condition of type "t.key NOT IN (c1, .... cN)"
where N>1000, was incorrectly converted to
  (-inf < X < c_min) OR (c_max < X)
Now this conversion is removed, we dont produce any range lists for such
conditions.


mysql-test/r/range.result:
  BUG#21282: Testcase
mysql-test/t/range.test:
  BUG#21282: Testcase
sql/opt_range.cc:
  BUG#21282: Incorrect query results for "t.key NOT IN (<big const list>) 
  In fix for BUG#15872, a condition of type "t.key NOT IN (c1, .... cN)"
  where N>1000, was incorrectly converted to 
    (-inf < X < c_min) OR (c_max < X)
  Now this conversion is removed, we dont produce any range lists for such
  conditions.
2006-08-15 21:08:22 +04:00