Commit graph

15260 commits

Author SHA1 Message Date
igor@rurik.mysql.com
2a7acba7e1 Fixed bug #21727.
This is a performance issue for queries with subqueries evaluation
of which requires filesort.
Allocation of memory for the sort buffer at each evaluation of a
subquery may take a significant amount of time if the buffer is rather big.
With the fix we allocate the buffer at the first evaluation of the
subquery and reuse it at each subsequent evaluation.
2006-10-31 17:31:56 -08:00
igor@rurik.mysql.com
17eb0b353e Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-10-17 12:25:53 -07:00
igor@rurik.mysql.com
c4c9fe63db Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug19579
2006-10-17 10:07:29 -07:00
gkodinov/kgeorge@macbook.gmz
8e7f0fe785 rename of the new members introduced in the fix for bug 21798 2006-10-17 19:22:13 +03:00
gkodinov/kgeorge@macbook.gmz
a64ae1844d Merge bk-internal:/home/bk/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B21798-5.0-opt-merge
2006-10-17 16:36:44 +03:00
gkodinov/kgeorge@macbook.gmz
f7b8937661 Bug#21798: memory leak during query execution with subquery in column
list using a function
When executing dependent subqueries they are re-inited and re-exec() for 
each row of the outer context.
The cause for the bug is that during subquery reinitialization/re-execution,
the optimizer reallocates JOIN::join_tab, JOIN::table in make_simple_join()
and the local variable in 'sortorder' in create_sort_index(), which is
allocated by make_unireg_sortorder().
Care must be taken not to allocate anything into the thread's memory pool
while re-initializing query plan structures between subquery re-executions.
All such items mush be cached and reused because the thread's memory pool
is freed at the end of the whole query.
Note that they must be cached and reused even for queries that are not 
otherwise cacheable because otherwise it will grow the thread's memory 
pool every time a cacheable query is re-executed. 
We provide additional members to the JOIN structure to store references 
to the items that need to be cached.
2006-10-17 16:20:26 +03:00
igor@rurik.mysql.com
c467be8d6e Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
In some cases this resulted in choosing non-optimal execution plans.
Now info of such potentially saragable predicates is saved in
an array and after reading const tables we check whether this
predicates has become saragable.
2006-10-16 14:25:28 -07:00
gkodinov/kgeorge@rakia.(none)
a5899ea863 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B22342-5.0-opt
2006-10-16 19:46:02 +03:00
gkodinov/kgeorge@macbook.gmz
0e954d2c1a Bug #22342: No results returned for query using max and group by
When using index for group by and range access the server isolates    
 a set of ranges based on the conditions over the key parts of the
 index used. Then it uses only the ranges over the GROUP BY fields to
 jump from one group to another. Since the GROUP BY fields may form a
 prefix over the index, we may use only a prefix of the ranges produced
 by the range optimizer.
 Each range contains a notion on whether it includes its border values.
 The problem is that when using a range prefix, the last range is open
 because it assumes that there is a range on the next keypart. Thus when
 we use a prefix range as it is, it excludes all border values.
 The solution is when ignoring the suffix of the range conditions 
 (to jump over the GROUP BY prefix only) the server must change the 
 remaining intervals so they always contain their borders, e.g. 
 if the whole range was :
 (1,-inf) <= (<group_by_col>,<min_max_arg_col>) < (1, 3) we must make
 (1) <= (<group_by_col>) <= (1) because (a,b) < (c1,c2) means :
 a < c1 OR (a = c1 AND b < c2).
2006-10-16 19:30:19 +03:00
gkodinov/kgeorge@macbook.gmz
abad78f455 Merge bk-internal:/home/bk/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B14019-5.0-opt
2006-10-16 16:28:13 +03:00
gkodinov/kgeorge@macbook.gmz
dff0a1ac7c Merge macbook.gmz:/Users/kgeorge/mysql/work/B14019-4.1-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B14019-5.0-opt
2006-10-16 13:24:54 +03:00
gkodinov/kgeorge@macbook.gmz
115616381d BUG#14019 : group by converts literal string to column name
When resolving unqualified name references MySQL was not
   checking what is the item type for the reference. Thus
   e.g a string literal item that has by convention a name
   equal to its string value will also work as a reference to 
   a SELECT list item or a table field.
   Fixed by allowing only Item_ref or Item_field to referenced by
   (unqualified) name.
2006-10-16 13:10:25 +03:00
evgen@moonbone.local
2b474898dc Bug#14959: ALTER TABLE isn't able to rename a view
The mysql_alter_table() was able to rename only a table.

The view/table renaming code is moved from the function rename_tables 
to the new function called do_rename().
The mysql_alter_table() function calls it when it needs to rename a view.
2006-10-13 21:59:52 +04:00
evgen@moonbone.local
ea8a646dc0 Bug#22138: Unhandled NULL caused server crash
The Cached_item_decimal::cmp() method wasn't checking for null pointer
returned from the val_decimal() of the item being cached.
This leads to server crash.

The Cached_item_decimal::cmp() method now check for null values.
2006-10-11 19:44:12 +04:00
gkodinov/kgeorge@macbook.local
5367793e8b Merge bk-internal:/home/bk/mysql-5.0-opt
into  macbook.local:/Users/kgeorge/mysql/work/B22781-5.0-opt
2006-10-09 19:53:07 +04:00
gkodinov/kgeorge@macbook.local
13633864bb Bug #22781: SQL_BIG_RESULT fails to influence sort plan
Currently SQL_BIG_RESULT is checked only at compile time.
 However, additional optimizations may take place after
 this check that change the sort method from 'filesort'
 to sorting via index. As a result the actual plan
 executed is not the one specified by the SQL_BIG_RESULT
 hint. Similarly, there is no such test when executing
 EXPLAIN, resulting in incorrect output.
 The patch corrects the problem by testing for
 SQL_BIG_RESULT both during the explain and execution
 phases.
2006-10-09 19:51:41 +04:00
holyfoot/hf@mysql.com/deer.(none)
58d8211822 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/16813/my50-16813
2006-10-01 18:06:07 +05:00
igor@rurik.mysql.com
3cf0903528 Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-09-29 11:36:27 -07:00
evgen@moonbone.local
299d243fcb Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/20503-bug-5.0-mysql
2006-09-29 21:22:47 +04:00
igor@rurik.mysql.com
964f4d7ba3 Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug22753
2006-09-29 08:29:59 -07:00
igor@rurik.mysql.com
89028dbba4 Fixed bug #22753.
After the patch for big 21698 equality propagation stopped
working for BETWEEN and IN predicates with STRING arguments.
This changeset completes the solution of the above patch.
2006-09-29 07:43:25 -07:00
holyfoot/hf@mysql.com/deer.(none)
3474fc9afd bug #16813 (WITH CHECK OPTION fails with UPDATE)
We use the condition from CHECK OPTION twice handling UPDATE command.
First we construnct 'update_cond' AND 'option_cond'
condition to select records to be updated, then we check the
'option_cond' for the updated row.
The problem is that first 'AND' condition is optimized during the 'select'
which can break 'option_cond' structure, so it will be unusable for
the sectond use - to check the updated row.
Possible soultion is either use copy of the condition in the first
use or to make optimization less traumatic for the operands.
I picked the first one.
2006-09-29 12:16:07 +05:00
evgen@moonbone.local
ee67c4c453 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/5505-bug-5.0-opt-mysql
2006-09-29 01:01:52 +04:00
evgen@moonbone.local
f6fbbf2002 Fixed bug#5505: Wrong error message on INSERT into a view
On an INSERT into an updatable but non-insertable view an error message was
issued stating the view being not updatable. This can lead to a confusion of a
user.

A new error message is introduced. Is is showed when a user tries to insert
into a non-insertable view.
2006-09-29 01:00:18 +04:00
evgen@moonbone.local
e0461067b8 Fixed bug#20503: Server crash due to the ORDER clause not taken into account
while space allocation

Under some circumstances DISTINCT clause can be converted to grouping.
In such cases grouping is performed by all items in the select list.
If an ORDER clause is present then items from it is prepended to group list.
But the case with ORDER wasn't taken into account when allocating the
array for sum functions. This leads to memory corruption and crash.

The JOIN::alloc_func_list() function now allocates additional space if there
is an ORDER by clause is specified and DISTINCT -> GROUP BY optimization is
possible.
2006-09-29 00:50:00 +04:00
gkodinov@dl145s.mysql.com
b0167d265f Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
2006-09-28 10:36:04 +02:00
gluh@mysql.com/gluh.(none)
4aaf7e34ff additional 'after merge' fix 2006-09-27 20:11:11 +05:00
gluh@mysql.com/gluh.(none)
c3d63bef2b after merge fix 2006-09-27 19:21:29 +05:00
gluh@mysql.com/gluh.(none)
437c94317b Merge mysql.com:/home/gluh/MySQL/Merge/4.1
into  mysql.com:/home/gluh/MySQL/Merge/5.0
2006-09-27 18:06:46 +05:00
gluh@mysql.com/gluh.(none)
a039376c43 Patch for bug#21432 is reverted 2006-09-27 17:49:16 +05:00
gkodinov/kgeorge@macbook.gmz
903387afc0 Bug #21174: Index degrades sort performance and optimizer does not honor IGNORE INDEX
- reversed the patch for 5.0 and moved to 5.1
2006-09-27 12:53:53 +03:00
igor@rurik.mysql.com
df1376a542 Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug21646
2006-09-25 07:40:54 -07:00
igor@rurik.mysql.com
c0569012d0 Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-09-25 06:46:15 -07:00
igor@rurik.mysql.com
a661bdda19 Fixed bug #21646.
Presence of a subquery in the ON expression of a join 
should not block merging the view that contains this join.
Before this patch the such views were converted into 
into temporary table views.
2006-09-25 06:15:14 -07:00
igor@rurik.mysql.com
55dd569bab Fixed bug #21853: assert failure for a grouping query with
an ALL/ANY quantified subquery in HAVING.
The Item::split_sum_func2 method should not create Item_ref
for objects of any class derived from Item_subselect.
2006-09-25 05:24:07 -07:00
lars/lthalmann@mysql.com/dl145j.mysql.com
7ce96bb579 Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
2006-09-23 07:12:00 +02:00
lars/lthalmann@mysql.com/dl145h.mysql.com
bbf84d6b9e Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
2006-09-23 06:00:50 +02:00
lars/lthalmann@mysql.com/dl145h.mysql.com
7e45d80362 Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-4.1-merge
2006-09-23 05:58:48 +02:00
georg@lmy002.wdf.sap.corp
67a701003c Fix for bug #19121: Windows incompatible udf_example 2006-09-22 14:42:43 +02:00
istruewing@chilla.local
f083782c42 Merge chilla.local:/home/mydev/mysql-5.0--main
into  chilla.local:/home/mydev/mysql-5.0-toteam
2006-09-21 10:55:23 +02:00
lars/lthalmann@mysql.com/dl145j.mysql.com
d20e326504 Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
2006-09-21 00:05:56 +02:00
igor@rurik.mysql.com
2e2c5a20c0 Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-09-20 09:47:36 -07:00
igor@rurik.mysql.com
d957636471 Fixed bug #20108.
Any default value for a enum fields over UCS2 charsets was corrupted
when we put it into the frm file, as it had been overwritten by its
HEX representation.
To fix it now we save a copy of structure that represents the enum
type and when putting the default values we use this copy.
2006-09-20 09:46:12 -07:00
igor@rurik.mysql.com
20b3e8a2f8 Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-09-20 08:10:21 -07:00
igor@rurik.mysql.com
f2225cab27 Fixed bug #22015: crash with GROUP_CONCAT over a derived table
that returns the results of aggregation by GROUP_CONCAT.
The crash was due to an overflow happened for the field
sortoder->length.
The fix prevents this overflow exploiting the fact that the
value of sortoder->length cannot be greater than the value of
thd->variables.max_sort_length.
2006-09-20 08:08:57 -07:00
lars/lthalmann@mysql.com/dl145j.mysql.com
0c03f9348d Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-4.1-merge
2006-09-20 16:17:30 +02:00
gkodinov/kgeorge@rakia.(none)
2da037c7d5 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B21540-5.0-opt
2006-09-19 19:18:52 +03:00
igor@rurik.mysql.com
294c0ccaa9 Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-4.1-opt
2006-09-19 08:42:58 -07:00
istruewing@chilla.local
7419f50245 After merge fix. 2006-09-19 14:26:18 +02:00
istruewing@chilla.local
5d509b32d4 Merge chilla.local:/home/mydev/mysql-4.1-bug14400-monty
into  chilla.local:/home/mydev/mysql-5.0-bug14400-monty
2006-09-19 11:27:00 +02:00