mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-36381: Comment "Procedure of keys generation ..." is in the wrong place
Move it from the middle of table.cc to sql_select.cc:generate_derived_keys()
This commit is contained in:
@@ -14059,6 +14059,36 @@ bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Procedure of keys generation for result tables of materialized derived
|
||||
tables/views.
|
||||
|
||||
A key is generated for each equi-join pair {derived_table, some_other_table}.
|
||||
Each generated key consists of fields of derived table used in equi-join.
|
||||
Example:
|
||||
|
||||
SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN
|
||||
t1 ON tt.f1=t1.f3 and tt.f2.=t1.f4;
|
||||
In this case for the derived table tt one key will be generated. It will
|
||||
consist of two parts f1 and f2.
|
||||
Example:
|
||||
|
||||
SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN
|
||||
t1 ON tt.f1=t1.f3 JOIN
|
||||
t2 ON tt.f2=t2.f4;
|
||||
In this case for the derived table tt two keys will be generated.
|
||||
One key over f1 field, and another key over f2 field.
|
||||
Currently optimizer may choose to use only one such key, thus the second
|
||||
one will be dropped after range optimizer is finished.
|
||||
See also JOIN::drop_unused_derived_keys function.
|
||||
Example:
|
||||
|
||||
SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN
|
||||
t1 ON tt.f1=a_function(t1.f3);
|
||||
In this case for the derived table tt one key will be generated. It will
|
||||
consist of one field - f1.
|
||||
*/
|
||||
|
||||
static
|
||||
bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array)
|
||||
{
|
||||
|
Reference in New Issue
Block a user