title: Mysql query taking too much time
body: <p>I have problem related to mysql database. i am linux webserver admin and i am facing a problem with a  mysql query. The database is very small. I tried to track in logs and found that a query is taking minimum 5 sec to respond . The first page of site is coming from the database. Client are using cms. when the server gets some number of hits database server starts to give response very slowly and wait time increases from 5 sec to several seconds.</p>
  
  <p>I checked slow query logs </p>
  
  <pre><code>{
  Query_time: 11.480138  Lock_time: 0.003837 Rows_sent: 921  Rows_examined: 3333
  
  SET timestamp=1346656767;
  SELECT `Tender`.`id`,
      `Tender`.`department_id`,
      `Tender`.`title_english`,
      `Tender`.`content_english`,
      `Tender`.`title_hindi`,
      `Tender`.`content_hindi`,
      `Tender`.`file_name`,
      `Tender`.`start_publish`,
      `Tender`.`end_publish`,
      `Tender`.`publish`,
      `Tender`.`status`,
      `Tender`.`createdBy`,
      `Tender`.`created`,
      `Tender`.`modifyBy`,
      `Tender`.`modified`
  FROM `mcms_tenders` AS `Tender`
  WHERE `Tender`.`department_id` IN ( 31, 33, 32, 30 );
  }
  </code></pre>
  
  <p>Every line in the log is same only there is diff in Query time.
  Is there any way tweak the performance?</p>
  
  <p><strong>Update:</strong> Here is the <code>EXPLAIN</code> result:</p>
  
  <pre><code>+----+-------------+--------+------+---------------+------+---------+------+-‌-----+-------------+
  | id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows | Extra       |
  +----+-------------+--------+------+---------------+------+---------+------+----‌​--+-------------+
  | 1  | SIMPLE      | Tender | ALL  | NULL          | NULL | NULL    | NULL | 3542 | Using where |
  +----+-------------+--------+------+---------------+------+---------+------+----‌​--+-------------+
  1 row in set, 1 warning (0.00 sec) 
  </code></pre>
  
  <p>client is saying they are using Index so i run the command to check the indexing.</p>
  
  <p>I got following output. Does It means they are using Indexing.</p>
  
  <p>+--------------+------------+----------+--------------+-------------+-----------+------------+----------+--------+------+------------+---------+
  | Table        | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
  +--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
  | mcms_tenders |          0 | PRIMARY  |            1 | id          | A         |        4264 |     NULL | NULL   |      | BTREE      |         | 
  +--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+</p>