Commit graph

386 commits

Author SHA1 Message Date
sergefp@mysql.com
1d3a0c0ec8 BUG#19021, Crash in ROR-index_merge optimizer:
get_best_covering_ror_intersect() was copying ror_scans starting from the 
end of the array and not from its beginning.
2006-04-13 16:05:32 +04:00
timour@mysql.com
b85bd1e835 Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-bug-16710
2006-03-31 12:39:33 +03:00
timour@mysql.com
eed7cf09dd Fix for BUG#16710.
The bug was due to a missed case in the detection of whether an index
can be used for loose scan. More precisely, the range optimizer chose
to use loose index scan for queries for which the condition(s) over
an index key part could not be pushed to the index together with the
loose scan.

As a result, loose index scan was selecting the first row in the
index with a given GROUP BY prefix, and was applying the WHERE
clause after that, while it should have inspected all rows with
the given prefix, and apply the WHERE clause to all of them.

The fix detects and skips such cases.
2006-03-31 12:34:28 +03:00
ramil@mysql.com
2a6217a9b1 Fix for bug #18306: MySQL crashes and restarts using subquery 2006-03-23 18:09:35 +04:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
igor@rurik.mysql.com
3af0eabc7f Fixed bug #16203.
If check_quick_select returns non-empty range then the function cost_group_min_max
cannot return 0 as an estimate of the number of retrieved records.
Yet the function erroneously returned 0 as the estimate in some situations.
2006-02-06 11:35:13 -08:00
serg@serg.mylan
8dc77f267b merged 2006-01-06 18:26:59 +01:00
monty@mysql.com
b0a5ea01ef Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-01-06 01:08:48 +02:00
monty@mysql.com
6e22e29de6 Review fixes of new pushed code
- Fixed tests
- Optimized new code
- Fixed some unlikely core dumps
- Better bug fixes for:
  - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
  - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
2006-01-06 00:47:49 +02:00
serg@serg.mylan
30c09d6dc0 merged 2006-01-03 18:12:03 +01:00
serg@serg.mylan
14f94dc0ca many warnings (practically safe but annoying) corrected 2006-01-03 17:54:54 +01:00
ingo@mysql.com
6b18dbef31 Bug#10932 - Building server with key limit of 128, makes test cases fail
Allow for configuration of the maximum number of indexes per table.
Added and used a configure.in macro.
Replaced fixed limits by the configurable limit.
Limited MyISAM indexes to its hard limit.
Fixed a bug in opt_range.cc for many indexes with InnoDB.

Tested for 2, 63, 64, 65, 127, 128, 129, 255, 256, and 257 indexes.
Testing this part of the bugfix requires rebuilding of the server 
with different options. This cannot be done with our test suite. 
Therefore I added the necessary test files to the bug report.
If you repeat the tests, please note that the ps_* tests fail for
everything but 64 indexes. This is because of differences in the 
meta data, namely field lengths for index names etc.
2005-12-02 16:27:18 +01:00
sergefp@mysql.com
e5592190e5 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug15204
2005-11-25 20:48:26 +03:00
sergefp@mysql.com
526a1d89c9 BUG#15024: get_best_covering_ror_intersect() tries to build ROR-intersection
by starting with an empty index set and adding indexes to it until it
becomes covering. If the set becomes covering after adding the first index,
return NULL and don't try constructing ROR-intersection of one index (which
caused a crash)
2005-11-25 20:47:22 +03:00
evgen@moonbone.local
e093fb1fd7 Fix bug#13293 Wrongly used index results in endless loop.
Loose index scan using only second part of multipart index was choosen, which
results in creating wrong keys and endless loop.

get_best_group_min_max() now allows loose index scan for distinct only if used
keyparts forms a prefix of the index.
2005-11-24 19:54:02 +03:00
bell@sanja.is.com.ua
806f9e24ff Inefficient usage of String::append() fixed.
Bad examples of usage of a string with its length fixed.
The incorrect length in the trigger file configuration descriptor
  fixed (BUG#14090).
A hook for unknown keys added to the parser to support old .TRG files.
2005-11-20 20:47:07 +02:00
bell@sanja.is.com.ua
4f42b35bba avoiding of calling Item::val_* methods family with opt_range mem_root, because its life time is too short. (BUG#14342) 2005-11-04 13:16:46 +02:00
evgen@moonbone.local
e92452c8ed opt_range.cc:
Additional fix for bug#14093
2005-11-03 17:43:03 +03:00
konstantin@mysql.com
d702915356 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/opt/local/work/mysql-5.0-14210
2005-11-03 15:24:55 +03:00
konstantin@mysql.com
7e3f757f2d A fix and a test case for Bug#14210 "Simple query with > operator on
large table gives server crash": make sure that when a MyISAM temporary
table is created for a cursor, it's created in its memory root,
not the memory root of the current query.
2005-11-03 14:20:13 +03:00
evgen@moonbone.local
30fdafea76 Fix bug #14093 Query takes a lot of time when date format is not valid
Invalid date like 2000-02-32 wasn't converted to int, which lead to not
using index and comparison with field as astring, which results in slow
query execution.

convert_constatn_item() and get_mm_leaf() now forces MODE_INVALID_DATES to
allow such conversion.
2005-11-03 13:53:49 +03:00
sergefp@mysql.com
841a2abde0 Post-merge fixes 2005-10-19 12:41:30 +04:00
sergefp@mysql.com
e7065d355c BUG#121915: Merge 4.1->5.0 2005-10-19 01:52:06 +04:00
sergefp@mysql.com
b91173af11 BUG#12915: post-review fixes 2005-10-18 14:04:14 +04:00
monty@mysql.com
17d7ba931d Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2005-10-08 03:37:23 +03:00
monty@mysql.com
78e828d32f Review of code pushed since last 5.0 pull:
Ensure that ccache is also used for C programs
mysql: Ensure that 'delimiter' works the same way in batch mode as in normal mode
mysqldump: Change to use ;; (instead of //) as a stored procedure/trigger delimiter
Fixed test cases by adding missing DROP's and rename views to be of type 'v#'
Removed MY_UNIX_PATH from fn_format()
Removed current_db_used from TABLE_LIST
Removed usage of 'current_thd' in Item_splocal
Removed some compiler warnings
A bit faster longlong2str code
2005-10-06 17:54:43 +03:00
sergefp@mysql.com
e9f2f9437a BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete
when there is no WHERE clause.
2005-09-30 15:21:37 +04:00
sergefp@mysql.com
3625ec5127 BUG#13081: Disable ROR-index_merge for NDB tables (by adding a
HA_KEY_SCAN_NOT_ROR index flag) as NDB index scans are not guaranteed to be ROR 
scans.
2005-09-30 14:20:15 +04:00
sergefp@mysql.com
7aca974fc8 Fix for BUG#13317: Make range optimizer able to produce ranges for "view.field IN (c1,c2)"
and "view.field BETWEEN c1 AND c2"
2005-09-21 21:36:15 +04:00
evgen@moonbone.local
097ca8ad90 Fix bug #12291 Table wasn't reinited for index scan after sequential scan
Optimizer did choose "Range checked for each record" for one of the tables.
For first few loops over that table it choose sequential access, on later
stage it choose to use index. Because table was previously initialized for 
sequential access, it skips intitialization for index access, and when
server tries to retrieve data error occurs.

QUICK_RANGE_SELECT::init() changes so if file already initialized for
sequential access, it calls ha_rnd_end() and initializes file for index
access.
2005-09-16 01:19:43 +04:00
aivanov@mysql.com
4b245a2803 join_outer.result, opt_range.cc, item_cmpfunc.cc:
Post merge changes
sql_yacc.yy:
  Post merge changes
sql_select.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions (post merge changes).
   The function add_key_fields() is modified. There cannot be NOT before
   BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
   now [NOT]BETWEEN/IN expressions.
2005-09-07 17:42:47 +04:00
aivanov@mysql.com
2165167200 Merge mysql.com:/home/alexi/dev/mysql-4.1-0
into  mysql.com:/home/alexi/dev/mysql-5.0-0
2005-09-06 23:49:54 +04:00
aivanov@mysql.com
fa51afedeb item_cmpfunc.h:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The classes Item_func_between, Item_func_if, Item_func_in are modified.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expressions.
   The class Item_func_opt_neg is added to factor out the functionality
   common for the modified classes Item_func_between and Item_func_in.
item_cmpfunc.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Added Item_func_between::fix_fields(), Item_func_if::fix_fields(),
   Item_func_in::fix_fields(). They correct generic calculation of
   the not_null_tables attribute when it is needed.
   Modified Item_func_between::val_int(), Item_func_in::val_int().
opt_range.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The function get_mm_tree() is modified. There cannot be NOT before
   BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
   now [NOT]BETWEEN/IN expressions.
sql_yacc.yy:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expresions.
join_outer.result:
  Fixed some testcases results (bugs #12101, #12102)
join_outer.test:
  Added testcases for bugs #12101, #12102
2005-09-06 18:03:08 +04:00
sergefp@mysql.com
c9aacbf943 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug12720
2005-08-30 14:15:05 +04:00
sergefp@mysql.com
5d336fbbe1 Fix for BUG#12720: In QUICK_RANGE_SELECT::reset(), reset in_range so next get_next() call
doesn't continue reading the last range.
2005-08-30 03:14:39 +04:00
timour@mysql.com
e62c877748 Fix for BUG#12672. 2005-08-29 17:13:42 +03:00
monty@mishka.local
2278e0319c Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mishka.local:/home/my/mysql-5.0
2005-07-18 19:03:01 +03:00
monty@mishka.local
78c65b5adc Cleanups during review
Changed defaults option --instance to --defaults-group-suffix
Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order
Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX
mysql_print_defaults now understands --defaults-group-suffix
Remove usage of my_tempnam() (not safe function)
if( -> if ( and while( to while (
2005-07-18 15:33:18 +03:00
igor@rurik.mysql.com
6ea960c8d6 opt_range.cc:
Fixed bug #11853.
  Corrected the code of the range optimization for
  NOT IN and NOT BETWEEN.
range.test, range.result:
  Fixed bug #11853.
2005-07-16 08:19:20 -07:00
monty@mysql.com
fe30ec9032 manual merge 2005-07-04 03:50:04 +03:00
monty@mysql.com
ec420bfb43 Fixes during review of new code
- Mostly indentation fixes
- Added missing test
- Ensure that Item_func_case() checks for stack overruns
- Use real_item() instead of (Item_ref*) item
- Fixed wrong error handling
2005-07-04 03:42:33 +03:00
monty@mysql.com
e4bb8377c7 Simple optimization
nsure that delete works not only on table->record[0] for federated tables
2005-06-29 12:44:40 +03:00
igor@rurik.mysql.com
230fe0d77e Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0
into rurik.mysql.com:/home/igor/mysql-5.0
2005-06-28 12:04:46 -07:00
igor@rurik.mysql.com
2310050488 opt_range.cc:
Fixed a compilation error.
2005-06-28 12:00:38 -07:00
konstantin@mysql.com
f7fd222384 Fixed comments. 2005-06-28 22:49:14 +04:00
igor@rurik.mysql.com
89cabf04ba Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2005-06-28 10:40:29 -07:00
konstantin@mysql.com
8b0cee88f0 A fix and a test case for Bug#10736 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY select within select".
The bug was caused by the reset of thd->mem_root to thd->main_mem_root in 
Item_subselect::exec, which in turn triggered too early free_root() for
data which was needed on subsequent fetches from a cursor.
This reset also caused a memory leak in stored procedures, as 
subsequent executions of instructions containing a subselect
were allocating memory in thd->main_mem_root, which is not freed
until the end of the entire SP, instead of the per-call mem_root,
which is freed in the end of execution of the instruction.
2005-06-28 20:52:15 +04:00
igor@rurik.mysql.com
451faae3c9 range.result, range.test:
Added a test case for bug #10031.
opt_range.cc:
  Fixed bug #10031: range condition was not used with
  views. Range analyzer did not take into account that
  view columns were always referred through Item_ref.
2005-06-28 07:27:00 -07:00
monty@mysql.com
10c4678def Move reset of insert_values to ensure it's done also during error conditions
This fixed a failure of insert_update.test on some platforms
2005-06-28 15:06:16 +03:00
kent@mysql.com
b3a00568fb opt_range.cc:
Added missing `;' to DBUG_RETURN()
2005-06-28 04:33:06 +02:00