student
03-20-2007, 01:11 PM
Hello,
I have a mysql database
Our server is: 64 bit processor server running 4 CPUs with 4 GB of RAM...
when I checked mysql slow queries log, I found so many lines like this with query _time around 6 to 12 for most of the queries:
-----------
# Tue Mar 20 03:02:33 2007
# Query_time: 12 Lock_time: 0 Rows_sent: 1 Rows_examined: 1
use trials_data;
SELECT id, site, rank, title, description, keywords, category, reviews, ratings, clicks FROM table WHERE site = 'firstsite' LIMIT 1
-------------
# Tue Mar 20 05:01:21 2007
# Query_time: 4 Lock_time: 0 Rows_sent: 10 Rows_examined: 5210
use trials_data;
SELECT DISTINCT site FROM table WHERE ( site='shopping' OR title LIKE '%shopping%' OR keywords LIKE '%shopping%' OR description LIKE '%shopping%') ORDER BY rank LIMIT 40, 10
-------------
# Tue Mar 20 05:08:36 2007
# Query_time: 17 Lock_time: 7 Rows_sent: 1 Rows_examined: 5012
use trials_data;
SELECT COUNT(DISTINCT site) FROM cb_urls15 WHERE ( site='recipes' OR title LIKE '%recipes%' OR keywords LIKE '%recipes%' OR description LIKE '%recipes%')
-----------
Here
id=primary key
site=index
category=index
title, description, keyword, reviews are 'text' with around 300 characters each.
others are of VARCHAR
I dont understand why I am getting these queries slow though Rows_sent: 1 and Rows_examined: 1
Please inform me how to optimize these queries.
Thank you.
I have a mysql database
Our server is: 64 bit processor server running 4 CPUs with 4 GB of RAM...
when I checked mysql slow queries log, I found so many lines like this with query _time around 6 to 12 for most of the queries:
-----------
# Tue Mar 20 03:02:33 2007
# Query_time: 12 Lock_time: 0 Rows_sent: 1 Rows_examined: 1
use trials_data;
SELECT id, site, rank, title, description, keywords, category, reviews, ratings, clicks FROM table WHERE site = 'firstsite' LIMIT 1
-------------
# Tue Mar 20 05:01:21 2007
# Query_time: 4 Lock_time: 0 Rows_sent: 10 Rows_examined: 5210
use trials_data;
SELECT DISTINCT site FROM table WHERE ( site='shopping' OR title LIKE '%shopping%' OR keywords LIKE '%shopping%' OR description LIKE '%shopping%') ORDER BY rank LIMIT 40, 10
-------------
# Tue Mar 20 05:08:36 2007
# Query_time: 17 Lock_time: 7 Rows_sent: 1 Rows_examined: 5012
use trials_data;
SELECT COUNT(DISTINCT site) FROM cb_urls15 WHERE ( site='recipes' OR title LIKE '%recipes%' OR keywords LIKE '%recipes%' OR description LIKE '%recipes%')
-----------
Here
id=primary key
site=index
category=index
title, description, keyword, reviews are 'text' with around 300 characters each.
others are of VARCHAR
I dont understand why I am getting these queries slow though Rows_sent: 1 and Rows_examined: 1
Please inform me how to optimize these queries.
Thank you.