title: AJAX request takes too long to complete the request
body: <p>I have a MySQL query which gets 17000 rows. If i execute that query directly in MySQL terminal using Putty, it takes 17 ~ 20 sec to get all rows. This is fine. </p>
  
  <p>But when i tried to execute the query using PHP with an AJAX request, It takes 50 ~ 60 sec to complete the request, even this query was cached. </p>
  
  <p>I am using CodeIgniter PHP framework for caching and its AJAX request. </p>
  
  <p>I agree, the HTTP request and PHP execution might take time when compared to direct MySQL query execution in the terminal. </p>
  
  <p>MySQL direct query execution : 20 sec
  Using HTTP, php, Codeigniter and JSON format and it is cached : 60 sec.</p>
  
  <p>The time difference too long i guess. </p>
  
  <p>Model query that i am trying to execute:</p>
  
  <pre><code>mysql&gt; explain SELECT col1, col2, col3, col4, IFNULL(col5,'N/A') AS 'col55', `col6`, col7, col8, col9 FROM table1 LEFT JOIN table1 ON table1.fkid_colid=`voyage id` AND table1.alias_type='voyage_display' WHERE column10='voyage';
  +----+-------------+--------------+------+-------------------------------------+---------+---------+------------------------------------+-------+-------------+
  | id | select_type | table        | type | possible_keys                       | key     | key_len | ref                                | rows  | Extra       |
  +----+-------------+--------------+------+-------------------------------------+---------+---------+------------------------------------+-------+-------------+
  |  1 | SIMPLE      | table1       | ALL  | NULL                                | NULL    | NULL    | NULL                               | 37770 | Using where |
  |  1 | SIMPLE      | table1       | ref  | PRIMARY,fk_table1_colid_idx         | PRIMARY | 4       | database.table1.column ID |     1 | Using index |
  +----+-------------+--------------+------+-------------------------------------+---------+---------+------------------------------------+-------+-------------+
  2 rows in set (0.00 sec)
  </code></pre>
  
  <p>Have any idea for this longer loading time? it would be if you suggest any optimization techniques for this?</p>