title: I am working on CodeIgniter framework with datatables and data loading speed is very slow
body: <p>I am using datatable for many purposes like pagination, search, hide/show column etc but when it comes to load data to the page it take a lot of time .There are round about 5000 entries in database let me show you the code here for proper understanding<br>
  Datatables Script:</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
     $(document).ready( function () {
     oTable = $('#myTable , #complete_ride , #incomplete_ride').DataTable({
     "dom": 'Btip',
     "deferRender": true,
     "ordering" : false,
     "pageLength": 20,
     "order": [[ 0, "desc" ]],
     "scrollX": true,
    buttons: ['colvis','excel' , 'csv'],
    });
  
   $('#search_item').keyup(function(){
    oTable.search($(this).val()).draw();
    });
    $('input.toggle').on( 'click', function (e) {
      e.preventDefault();
  
      // Get the column API object
      var column = oTable.column( $(this).attr('data-column') );
      // Toggle the visibility
      column.visible( ! column.visible() );
   });
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>Here is the code of Controller:</p>
  
  <pre><code>function index()
  {
   $data['user_basic'] = $this-&gt;User_basic_model-&gt;get_all_user_basic();
   $data['_view'] = 'user_basic/index';
   $this-&gt;load-&gt;view('layouts/main',$data);
  }
  </code></pre>
  
  <p>and code of model:</p>
  
  <pre><code> function get_all_user_basic()
   {
      $this-&gt;db-&gt;order_by('user_id', 'desc');
      $this-&gt;db-&gt;select('table1.user_id,
                         table1.full_name,
                         table1.email,
                         table1.phone,
                         table1.password,
                         table1.date_of_birth,
                         table1.gender,
                         table1.address,
                         table1.cnic_no,
                         table1.reg_no,
                         table1.status,
                         table1.access_level,
                         table2.institute_id,
                         table2.institute_name,
                         table3.department_id,
                         table3.department_name,
                         table1.total_rides,
                         table1.total_distance,
                         table1.total_calories,
                         table1.wallet_amount,
                         table1.wallet_expiry,
                         table1.reffered_by,
                         table1.refferel_key,
                         table1.failed_login_attempts,
                         table1.last_login,
                         table1.last_login_ip,
                         table1.creation_date,
                         table1.update_date,
                         table1.delete_date,
                         table1.total_time');
      $this-&gt;db-&gt;from('table1');
      $this-&gt;db-&gt;join('table2' , 'table1.institute_id = table2.institute_id' , 'left outer');
      $this-&gt;db-&gt;join('table3' , 'table1.department_id = table3.department_id' , 'left outer');
      return $this-&gt;db-&gt;get()-&gt;result_array();
  }
  </code></pre>