I am facing some very weird issue here. We have a laravel API hosted on AWS EC2 and we using RDS (mysql 5.6). I recently enabled performance_schema on RDS. Following is the behavior I am noticing
- We have two databases on our RDS instance. One for wordpress and one for our laravel API. Wordpress database query are getting digested fine. But queries run from our laravel app are not.
- For some reason when I connect MySql Workbench to RDS Instance and executes queries on our Laravel database then they appear in statement summary fine.
- I logged into my EC2 machine, connected to MySQL on RDS and executes some queries and they are getting tracked in statement summary.
So it looks like only when queries are executed from our Laravel App, they do not get tracked.
Our Laravel version is 4.2. I am trying to identify the reason from last two days, any help will be a relief.
The user that I used in all above steps is same and have all privileges on all databases.
--EDIT--
I performed many other tests and they all point out to only one conclusion that it has something to do with Laravel. I created a simple php file on the same server where laravel is hosted. In this file, I connected to the same instance/database with same user/password. Only thing I did in this file was to run a very simple Query on $pdo like this.
$stmt = $pdo->query('SELECT name FROM trades');
while ($row = $stmt->fetch())
{
echo $row['name'] . "\n";
}
and it appears in query analytics [https://prnt.sc/j3ochd] (I manually checked performance_schema.events_statements_summary_by_digest as well)
But then I can hit our laravel api which infact returns the entries from trade table itself ( very much like the query I run above). but that would appear in my query analytics reports ( Percona PMM) or in events_statements_summary_by_digest
SELECT ...
" is eventually sent to the server, at which point the server will record it if requested. – Toombs