0
votes

This problem has been pulling my hair out in this week. This is really annoying me because I still cant find the solution. My problem: localhost takes a long time to load. Localhost takes up to 1400 seconds to load data. Maybe this information can help you to know about my problem:

I have view table. My view table query is like this

select DISTINCT `TahunAwal`, 
   (SELECT COUNT(*) AS `< 2.50` from `akdhis_kelanjutanstudi` 
        LEFT JOIN `akdmst_mahasiswamagister` on `akdhis_kelanjutanstudi`.`MahasiswaID` = `akdmst_mahasiswamagister`.`MahasiswaID`
        LEFT JOIN `akdhis_statusmahasiswa` on `akdhis_kelanjutanstudi`.`MahasiswaID` = `akdhis_statusmahasiswa`.`MahasiswaID`
        LEFT JOIN `akdref_tahunsemester` on `akdhis_statusmahasiswa`.`TahunSemesterID` = `akdref_tahunsemester`.`ID`
        LEFT JOIN `akdref_tahunakademik` on `akdref_tahunsemester`.`TahunAkademikID` = `akdref_tahunakademik`.`ID`
        WHERE `IPK` < 2.50 AND `SemesterMahasiswa` = 8 AND `mhsMagister`.`TahunAwal`=`akdref_tahunakademik`.`TahunAwal`) AS `< 2.50`,

    (SELECT COUNT(*) AS `2.50-2.74` from `akdhis_kelanjutanstudi` 
        LEFT JOIN `akdmst_mahasiswamagister` on `akdhis_kelanjutanstudi`.`MahasiswaID` = `akdmst_mahasiswamagister`.`MahasiswaID`
        LEFT JOIN `akdhis_statusmahasiswa` on `akdhis_kelanjutanstudi`.`MahasiswaID` = `akdhis_statusmahasiswa`.`MahasiswaID`
        LEFT JOIN `akdref_tahunsemester` on `akdhis_statusmahasiswa`.`TahunSemesterID` = `akdref_tahunsemester`.`ID`
        LEFT JOIN `akdref_tahunakademik` on `akdref_tahunsemester`.`TahunAkademikID` = `akdref_tahunakademik`.`ID`
        WHERE 2.50 < `IPK` < 2.74 AND `SemesterMahasiswa` = 8 AND `mhsMagister`.`TahunAwal`=`akdref_tahunakademik`.`TahunAwal`) AS `2.50-2.74`                
from `akdref_tahunakademik` AS `mhsMagister` 
ORDER BY `mhsMagister`.`TahunAwal`

that's a part of my codes

and the result in phpmyadmin is like this

enter image description here

I think localhost takes a long time to load data because of the tables that consists of many data records, but I don't know how to solve that problem. I have tried to change

ServerName Localhost to ServerName 127.0.0.1:80.

I also have edited

my.ini.

I uncommented

bind-address="127.0.0.1"

I edited

config.inc.php

I change

$cfg['Servers'][$i]['host'] = 'localhost' to $cfg['Servers'][$i]['host'] = '127.0.0.1'

but localhost still too slow.

I use XAMPP in windows 7.

is there any way to fix that problem? Please help me to fix that problem. Thank you so much

1

1 Answers

0
votes

Create a view out of your query and pull the records using the view that you made from it. See if it could make any changes as views seem to be a faster workaround for handling lots of data rather than running a select query for it every time.

Also, you might want to have your SELECT query restricted to just the columns that you need for the formula as it can also affect the loading speed of your query.