laracraft-tech/laravel-xhprof

[1.x] id column has not index!

Closed this issue · 3 comments

Version

v1.0.9

Database Driver

MySQL

Description

I created details table using the following command:
php artisan vendor:publish --provider="LaracraftTech\LaravelXhprof\XHProfServiceProvider" --tag="migrations"

I was able to view the xhprof page the first time, but after a while, the xhprof page timed out. I found the following slow query in the MySQL slow query log:

`SELECT * FROM `details` WHERE `id` = '651e3280bba53';`

OMG, I discovered that the id column in the details table does not have an index!

The id column requires an index, perhaps even a unique key instead of just an index.

@ktanakaj thanks for your report. I just took the SQL statement from the XHGUI and did not have a closer look. I think I'll gonna fix this. Also the idcount field seems not to be used. So maybe it can be dropped... May I ask, how many entries do you have in your detailstable?

Thanks for the quick response. My details table has over one hundred thousand records.

MySQL [mydb]> SELECT COUNT(*) FROM details;
+----------+
| COUNT(*) |
+----------+
|   117220 |
+----------+

@ktanakaj it's fixed: https://github.com/laracraft-tech/laravel-xhprof/releases/tag/v1.0.10

Feel free to update the package and republish/remigrate the new migration!