MYSQL slow queries in “slow queries log” - but same queries runs very fast manually


Edwin Goei
HOME ยป Databases

as title states, in my database various queries appear in the slow queries log, but when I run them manually they run 10x faster.


for example a relatively simple select query with several order by params takes often up to 100 seconds in log(yes table is very big)... but when I run it myself on the same DB it takes 2 seconds or so.


I've examined the server's performance and there doesn't seem to be a particular slowdown or bottleneck at the time, nor are many queries taking long time at that period but just the one.


how can I begin to analyze such a problem?


thanks for the help


Related to : MYSQL slow queries in “slow queries log” - but same queries runs very fast manually
MYSQL slow queries in “slow queries log” - but same queries runs very fast manually
Databases

as title states, in my database various queries appear in the slow queries log, but when I run them manually they run 10x faster.


for example a relatively simple select query with several order by params takes often up to 100 seconds in log(yes table is very big)... but when I run it myself on the same DB it takes 2 seconds or so.


I've examined the server's performance and there doesn't seem to be a particular slowdown or bottleneck at the time, nor are many queries taking long time at that period but just the one.


how can I begin to analyze such a problem?


thanks for the help


MySQL slow log contains fast queries
Databases

I have the long query time set to 15 yet MySQL is still showing results with a query time of 0 in the slow query log.
It says enter time in "seconds" in the MySQL Administrator but did it mean in milliseconds??
MySQL slow query at first, fast for sub queries
Databases

PHP: I have a simple pagination script which uses two queries.


MySQL: Using server version 4.1.25 - I have two tables (products, categories) with the item_num field tying them together to retrieve products via category and both have unique ID fields which are indexed and auto-incremented. They're both MyISAM types.


Query #1: SELECT COUNT(*) FROM rituals_collections, rituals_products WHERE rituals_collections.item_num = rituals_products.item_num AND rituals_collections.collection = '$currentCollection' $queryString ORDER BY rituals_products.id


This SHOULD grab only the record count using those filters so it doesn't ne

mysql slow on first query, then fast for related queries
Databases

I have been struggling with a problem that only happens when the database has been idle for a period of time for the data queried. The first query will be extremely slow, on the order of 30 seconds and then related queries will be fast like 0.1 seconds. I am assuming this is related to caching, but I have been unable to find the cause of it.


Changing the mysql variables tmp_table_size, max_heap_table_size to a larger size had no effect except to create the temp tables in memory.


I do not think this is related to the query itself as it is well indexed and after the first slow query, variants of the same query do not show up in the slow query log.



HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .