Commit 4c17825a authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Update of query cache code

parent 40da5046
Loading
Loading
Loading
Loading
+30 −5
Original line number Diff line number Diff line
@@ -17477,6 +17477,7 @@ information and a description of what it means.
* OPTIMIZE TABLE::              @code{OPTIMIZE TABLE} Syntax
* ANALYZE TABLE::               @code{ANALYZE TABLE} Syntax
* FLUSH::                       @code{FLUSH} Syntax
* RESET::                       @code{RESET} Syntax
* KILL::                        @code{KILL} Syntax
* SHOW::                        @code{SHOW} Syntax
@end menu
@@ -17564,7 +17565,7 @@ If the table hasn't changed since the last @code{ANALYZE TABLE} command,
the table will not be analysed again.
@node FLUSH, KILL, ANALYZE TABLE, Database Administration
@node FLUSH, RESET, ANALYZE TABLE, Database Administration
@subsection @code{FLUSH} Syntax
@findex FLUSH
@@ -17605,7 +17606,9 @@ signal to the @code{mysqld} server.
@item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in
the @code{mysql} database.
@item @code{TABLES} @tab Closes all open tables and force all tables in use to be closed.
@item @code{QUERY CACHE} @tab Defragment the query cache to better utilize the memory.  This command will not remove any queries from the cache.
@item @code{TABLES} @tab Closes all open tables and force all tables in use to be closed. This also flushes the query cache.
@item @code{[TABLE | TABLES] table_name [,table_name...]} @tab Flushes only the given tables.
@@ -17618,12 +17621,34 @@ You can also access each of the commands shown above with the @code{mysqladmin}
utility, using the @code{flush-hosts}, @code{flush-logs}, @code{reload},
or @code{flush-tables} commands.
Take also a look at the @code{RESET} command used with
replication. @xref{Replication SQL}.
Take also a look at the @code{RESET} command used with replication.
@xref{RESET}.
@node RESET, KILL, FLUSH, Database Administration
@subsection @code{RESET} Syntax
@example
FLUSH flush_option [,flush_option]
@end example
The @code{RESET} command is used to clear things. It also acts as an stronger
version of the @code{FLUSH} command.  @xref{FLUSH}.
@multitable @columnfractions .15 .85
@item @code{MASTER}
@tab Deletes all binary logs listed in the index file, resetting the binlog
index file to be empty. In pre-3.23.26 versions, @code{FLUSH MASTER} (Master)
@item @code{SLAVE}
@tab Makes the slave forget its replication position in the master
logs. In pre 3.23.26 versions the command was called
@code{FLUSH SLAVE}(Slave)
@item @code{QUERY CACHE}
@tab Removes all query results from the query cache.
@end multitable
@node KILL, SHOW, FLUSH, Database Administration
@node KILL, SHOW, RESET, Database Administration
@subsection @code{KILL} Syntax
@findex KILL
+3 −2
Original line number Diff line number Diff line
@@ -78,8 +78,9 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
#define REFRESH_READ_LOCK	16384	/* Lock tables for read */
#define REFRESH_FAST		32768	/* Intern flag */

#define REFRESH_QUERY_CACHE	65536	/* flush query cache */
#define REFRESH_QUERY_CACHE_FREE 0x10000L /* pack query cache */
/* RESET (remove all queries) from query cache */
#define REFRESH_QUERY_CACHE	65536
#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */

#define CLIENT_LONG_PASSWORD	1	/* new more secure passwords */
#define CLIENT_FOUND_ROWS	2	/* Found instead of affected rows */
+5 −0
Original line number Diff line number Diff line
@@ -28,3 +28,8 @@ select * from t1;
n
345
drop table t1;
flush query cache;
reset query cache;
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
+38 −0
Original line number Diff line number Diff line
reset query cache;
flush status;
drop table if exists t1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
a
1
2
3
select * from t1;
a
1
2
3
select sql_no_cache * from t1;
a
1
2
3
select length(now()) from t1;
length(now())
19
19
19
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
show status like "Qcache_inserts";
Variable_name	Value
Qcache_inserts	1
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	1
drop table t1;
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
+9 −0
Original line number Diff line number Diff line
@@ -66,3 +66,12 @@ connection con2;
insert into t1 values (345);
select * from t1;
drop table t1;

#
# Test that QUERY CACHE commands doesn't core dump.
# (Normally we don't have a cache active at this point)
#

flush query cache;
reset query cache;
show status like "Qcache_queries_in_cache";
Loading