php - This page is taking too long to load -
i have created view page on php zend framework. view page has 10 methods. each method has 3 sql queries returning thee values. calling these 10 methods 10 times. queries working on table of 24,000 rows. it's taking 2-3 minutes load view page. storing function results in arrays , using array values display.
how can implement output caching on this?
source code view part is: variables:
$no_of_customers = array(); $no_of_customers_ee = array(); $no_of_customers_nee = array(); $unique_customers = array(); $unique_customers_ee = array(); $unique_customers_nee = array(); $no_of_sent = array(); $no_of_sent_ee = array(); $no_of_sent_nee = array(); $no_of_opened = array(); $no_of_opened_ee = array(); $no_of_opened_nee = array(); $no_of_surveys = array(); $no_of_surveys_ee = array(); $no_of_surveys_nee = array(); $promoter = array(); $promoter_ee = array(); $promoter_nee = array(); $detractor = array(); $detractor_ee = array(); $detractor_nee = array(); $passive = array(); $passive_ee = array(); $passive_nee = array();
one of function using is
function unique_customer($con,$start_date,$end_date ,&$unique_customers,$i,$customertable,&$unique_customers_ee,&$unique_customers_nee) { $result = mysqli_query($con,"select count(distinct emailaddress) total, product $customertable importdate >='$start_date' , importdate <'$end_date' ;"); $rs = mysqli_fetch_array($result); $unique_customers[$i] = $rs['total']; unset($rs); $result_ee = mysqli_query($con,"select count(distinct emailaddress) total_ee, product $customertable importdate >='$start_date' , importdate <'$end_date' , product = '';"); $rs_ee = mysqli_fetch_array($result_ee); $unique_customers_ee[$i] = $rs_ee['total_ee']; unset($rs_ee); $result_nee = mysqli_query($con,"select count(distinct emailaddress) total_nee, product $customertable importdate >='$start_date' , importdate <'$end_date' , product != '';"); $rs_nee = mysqli_fetch_array($result_nee); $unique_customers_nee[$i] = $rs_nee['total_nee']; unset($rs_nee); }
calling these functions 10 times , storing values in arrays
Comments
Post a Comment