Hello,
je me trouve face a un problème:
j'ai une requête SQL qui fonctionne très bien (elle m'affiche ce que je veux voir) mais qui a un temps de traitement relativement long.
je me demandais donc si il été possible d'optimiser la requête et/ou sont traitement php.Page générée en 28.6133s avec 7 requêtes
voici ma requête:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 if(isSet($_POST['locID'])){ $locID = $_POST['locID']; echo $locID; if ($locID == 0){ $loc="item.ownerid = 1234567890"; } else{ $loc="item.locationID='$locID' and item.ownerid = 1234567890"; } $request =("select *, object.typeName as Name, flag.flagText as Flagtext, station.stationName as Stationname , item.locationID, item.typeid, item.quantity, item.ownerid, division.description from (SELECT item.quantity, item.ownerid, item.typeid, loc.itemid, item.flag, loc.locationid from eveapi.corpassetlist as item inner join eveapi.corpassetlist as loc on loc.lft < item.lft and loc.rgt > item.rgt and loc.ownerid = 1234567890) item inner join evedump.invtypes as object on item.typeid = object.typeid inner join evedump.invflags as flag on item.flag = flag.flagID left outer join eveapi.corpdivisions as division on flag.flagID = division.accountKey - 885 and division.ownerID=1234567890 left outer join evedump.stastations as station on item.locationID = station.stationID + 6000001 WHERE $loc ;");
et son traitement pour affichage:
quelques variables dans le traitement sont visible mais ne sont pas utile a l'optimisation de la requête (comme $virtual qui est un nombre qui n'a rien a voir)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 while ($row = mysql_fetch_array($result)) { echo' <tr> <td class="stockback" width="30">'.$row['typeID'].'</td> <td class="stockback">'.$row['Name'].'</td> <td class="stock'.$color.'" width="50">'.$row['quantity'].'</td> <td class="stock'.$color.'" width="50">'.$cmdqty.'</td> <td class="stockv'.$vcolor.'" width="50">'.$virtual.'</td> <td class="stockback" width="320">'.$row['stationName'].'</td> <td class="stockback" width="250">'.$row['description'].'</td> <td class="stockback" width="250">'.$row['Flagtext'].'</td> </tr> '; }
Je ne sais pas si c'est un problème de requête ou de traitement d'affichage et je ne sais pas non plus si c'est optimisable.
Merci pour votre aide
Partager