Yuantao
Yuantao

Reputation: 2872

Is SELECT keyword still case sensitive in MySQL query cache?

The Query Performance chapter from High Performance MySQL book (2004) said MySQL(4.0.1) attempts to locate the results of any 'SELECT' query in the query cache before bothering to analyze or execute it. MySQL uses the exact query text it receives, so the cache is sensitive, which means

SELECT * FROM table1

is different from

select * FROM table1

I'd like to know if this still is the case in MySQL 5.x, so we should always type 'SELECT' instead of 'select'.

Upvotes: 0

Views: 390

Answers (2)

William Riley
William Riley

Reputation: 51

The MySQL query cache is case (and byte) sensitive.

Incoming queries are compared to those in the query cache before parsing, so the following two queries are regarded as different by the query cache:

SELECT * FROM tbl_name
Select * from tbl_name

Queries must be exactly the same (byte for byte) to be seen as identical. In addition, query strings that are identical may be treated as different for other reasons. Queries that use different databases, different protocol versions, or different default character sets are considered different queries and are cached separately.

Upvotes: 5

user725913
user725913

Reputation:

It's not, but you would know that if you tried it!

EDIT: Neither are the following, just in case you were wondering.

  1. Insert
  2. Where
  3. From
  4. Select (above)
  5. Order
  6. Any of the others!

Upvotes: -1

Related Questions