I’m using Cakephp 3.3 and DebugKit is enabled. I have noticed that ‘some’ of the controller actions are issuing many additional SQL queries related to information_scheme like these:
SHOW FULL COLUMNS
information_schema.key_column_usage AS kcu
INNER JOIN information_schema.referential_constraints AS rc ON (
kcu.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
AND kcu.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
kcu.TABLE_SCHEMA = 'myschema’
AND kcu.TABLE_NAME = 'businesses’
AND rc.TABLE_NAME = ‘businesses’
- Why is this happening ?
- Is this there a way to stop Cakephp from doing this ?
- Is it happening because of DebugKit ?
There is a benefit from it - if you add some columns to your SQL table, then they automatic show in your php variable.
How to prevent it ? And does it have anything to do with DebugKit ?
I saw this when debug kit is on, but never try to check what happens in "production: it never disturbs me. You can set some sql log options in config turn debug to false and check.
But I know that if you add some column in production mode, then before clear cache it can miss them, so I guess that in “production” there will be no schema check.
Correct. In production mode, cache duration for the schema meta data is much higher by default. This metadata cache holds the results of the
information_schema queries, and allows CakePHP to operate without emitting these queries.