1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Add new user variables for tuning memory usage:

query_alloc_block_size, query_prealloc_size, range_alloc_block_size,transaction_alloc_block_size and transaction_prealloc_size
Add more checks for "out of memory" detection in range optimization
This commit is contained in:
monty@mashka.mysql.fi
2003-10-11 22:00:24 +03:00
parent 9bba878b8c
commit c95d142f8f
21 changed files with 257 additions and 81 deletions

View File

@@ -1000,7 +1000,8 @@ err:
Approximate how many records will be used in each table
*****************************************************************************/
static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
TABLE *table,
key_map keys,ha_rows limit)
{
int error;
@@ -1009,7 +1010,7 @@ static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
{
select->head=table;
table->reginfo.impossible_range=0;
if ((error=select->test_quick_select(keys,(table_map) 0,limit))
if ((error=select->test_quick_select(thd, keys,(table_map) 0,limit))
== 1)
DBUG_RETURN(select->quick->records);
if (error == -1)
@@ -1290,8 +1291,8 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
found_const_table_map,
s->on_expr ? s->on_expr : conds,
&error);
records= get_quick_record_count(select,s->table, s->const_keys,
join->row_limit);
records= get_quick_record_count(join->thd, select, s->table,
s->const_keys, join->row_limit);
s->quick=select->quick;
s->needed_reg=select->needed_reg;
select->quick=0;
@@ -2687,7 +2688,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/* Join with outer join condition */
COND *orig_cond=sel->cond;
sel->cond=and_conds(sel->cond,tab->on_expr);
if (sel->test_quick_select(tab->keys,
if (sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
OPTION_FOUND_ROWS ?
@@ -2697,7 +2698,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
we have to check isn't it only "impossible ON" instead */
sel->cond=orig_cond;
if (!tab->on_expr ||
sel->test_quick_select(tab->keys,
sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
OPTION_FOUND_ROWS ?
@@ -5047,7 +5048,8 @@ test_if_quick_select(JOIN_TAB *tab)
{
delete tab->select->quick;
tab->select->quick=0;
return tab->select->test_quick_select(tab->keys,(table_map) 0,HA_POS_ERROR);
return tab->select->test_quick_select(tab->join->thd, tab->keys,
(table_map) 0, HA_POS_ERROR);
}
@@ -6014,7 +6016,8 @@ create_sort_index(JOIN_TAB *tab, ORDER *order, ha_rows filesort_limit,
For impossible ranges (like when doing a lookup on NULL on a NOT NULL
field, quick will contain an empty record set.
*/
if (!(select->quick=get_ft_or_quick_select_for_ref(table, tab)))
if (!(select->quick=get_ft_or_quick_select_for_ref(tab->join->thd,
table, tab)))
goto err;
}
}