[MDEV-6356] QUERY CACHE - Query Cache And Autocommit Created: 2014-06-18  Updated: 2022-09-08

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 5.5.38, 10.0.12
Fix Version/s: 5.5

Type: Bug Priority: Minor
Reporter: BELUGABEHR Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: querycache, upstream-wontfix


 Description   

I was using Maria 10.0.10 today and was banging my head against a wall for a few hours trying to figure out why my queries were missing the query cache.

http://bugs.mysql.com/bug.php?id=42197

I am working on a legacy PERL project that spawns many short-lived processes that connect to the database and do a single query before exiting.

my $dsn = "dbi:mysql:database=test";
my $dbh = DBI->connect($dsn, undef, undef, {RaiseError => 0, AutoCommit => 0});
 
# 1. Prepare query
# 2. Executed query (misses cache)
# 3. Process result

When DBI connects to the SQL server, the first thing it does is issue the "SET" command and then the query comes quickly behind it:

SET AUTOCOMMIT=0;
SELECT * FROM test;

When it then executes its query, it misses the query cache every time.



 Comments   
Comment by roberto spadim [ 2014-09-22 ]

the problem is autocommit and begin are part of flags that make a query unique, check documentation:
https://mariadb.com/kb/en/mariadb/documentation/optimization-and-tuning/buffers-caches-and-threads/query-cache/

Generated at Thu Feb 08 07:11:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.