SQL very fast here & very slow there

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have realized a php web page with this "heavy" SQL query, necessary to show a list of students:

$sqlcom = "SELECT Alunni.Cod_Alunno, Nome, Cognome, Scritto, Orale, Assenze
FROM Alunni, Scrutini, Iscritti
WHERE Alunni.Cod_Alunno = Scrutini.Alunno AND Scrutini.Alunno = Iscritti.Cod_Alunno
AND Scrutini.Anno = Iscritti.Anno AND Iscritti.Anno = $Anno
AND Iscritti.Classe = $Classe AND Scrutini.Materia = '$Materia'
ORDER BY Cognome, Nome";
$alunni = odbc_connect("Orario", "admin", "" );
$cur = odbc_exec($alunni, $sqlcom);
...

The three tables are rather big (about 9000 records); they are Paradox tables which php sees through the Windows ODBC interface.

I have two copies of this DB one on my home PC (Athlon XP 1600, with Win-XP, Apache 1.3.27 and Php 4.3), the other on the server of my school (HP e200 Pentium 1000 with Windows 2000) which works as a web server with Apache 1.3.24 and Php 4.23.

Now something very strange happens: on my home PC the Select works perfectly and is executed in a flash, the web page appearing in less than one second.
On the Win2000 server the same SQL command behaves extremely slow and takes up to 60 seconds to execute and show, and is very often timed out. There is no difference executing the command directly on the server or from a PC connected to the server in the LAN.

I understand that a server has to share his time and resources ... but such a huge difference is really surprising for me. And I have many other SQL queries working decently on the server.

I've lookeed for differences between php.ini files, but found nothing of meaning.

Any ideas? Is there a way to speed up this command on the server?

Thanks to anybody which can help me!


Paolo Bonavoglia
---------------------------------------------------------------------------
Docente di Matematica e Fisica
Responsabile Lab.Informatica e sito Web

Liceo Classico "Marco Foscarini"
Cannaregio 4942
I 30121 VENEZIA

Tel. 041,5224845
Fax 041,5201657

E-Mail paolo.bonavoglia@liceofoscarini.it

--------------------------------------------------------------------------
Pagine Web http://www.liceofoscarini.it/



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux