From 57c2f22a54f33267e2f9cc7437f78f36b47a32fe Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Nov 2006 15:41:48 +0300 Subject: Small cleanup in code handling stored routines/table prelocking. Use lazy initialization for Query_tables_list::sroutines hash. This step should significantly decrease amount of memory consumed by stored routines as we no longer will allocate chunk of memory required for this HASH for each statement in routine. include/hash.h: Introduced auxillary hash_init_opt() macro which simplifies lazy initialization of HASH objects. sql/sp.cc: Use lazy initialization for Query_tables_list::sroutines hash. This step should significantly decrease amount of memory consumed by stored routines as we no longer will allocate chunk of memory required for this HASH for each statement in routine. sql/sql_lex.cc: Use lazy initialization for Query_tables_list::sroutines hash. This step should significantly decrease amount of memory consumed by stored routines as we no longer will allocate chunk of memory required for this HASH for each statement in routine. sql/sql_lex.h: Updated comment describing Query_tables_list::sroutines to reflect that now we are use lazy initialization for this hash. Added constant for initial size of this hash. --- sql/sql_lex.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.h') diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 378f968118e..bfe7d9518f3 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -742,7 +742,11 @@ public: 0 - indicates that this query does not need prelocking. */ TABLE_LIST **query_tables_own_last; - /* Set of stored routines called by statement. */ + /* + Set of stored routines called by statement. + (Note that we use lazy-initialization for this hash). + */ + enum { START_SROUTINES_HASH_SIZE= 16 }; HASH sroutines; /* List linking elements of 'sroutines' set. Allows you to add new elements -- cgit v1.2.1