mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix cost calculation for get_best_group_min_max()
If the final range restrictions (SEL_ARG tree) over GROUP BY columns are single-point, we can compute the number of GROUP BY groups. Example: in the query: SELECT ... FROM tbl WHERE keypart1 IN (1,2,3) and keypart2 IN ('foo','bar') Other things: - Fixed cost calculation to more correctly count the number of blocks that may be read. The old code could use the total blocks in the file even if a range was available.
This commit is contained in:
@@ -302,6 +302,7 @@ class SEL_ARG :public Sql_alloc
|
||||
{
|
||||
static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag,
|
||||
uint8 b_flag);
|
||||
bool min_max_are_equal() const;
|
||||
public:
|
||||
uint8 min_flag,max_flag,maybe_flag;
|
||||
uint8 part; // Which key part
|
||||
@@ -401,6 +402,7 @@ public:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
int number_of_eq_groups(uint group_key_parts) const;
|
||||
inline void merge_flags(SEL_ARG *arg) { maybe_flag|=arg->maybe_flag; }
|
||||
inline void maybe_smaller() { maybe_flag=1; }
|
||||
/* Return true iff it's a single-point null interval */
|
||||
|
Reference in New Issue
Block a user