Ciao a tutti, volevo chiedervi come si fa per fare un sql ottimizzato?
Cioe' devo fare una select su un file e stampare i dati in una tabella,
solo che questo file ha 17.000 record quindi la pagina ci mette dieci secondi a caricare.
E' possibile fare in modo che vengano caricati solo es. 20 record e poi quando faccio un roll
carichi i successivi 20 ecc... e se faccio rollup mi carichi i 20 record precedenti.
posto la select che utilizzo adesso.
<?php
$sql = "
SELECT
CAST(MRJID AS CHAR(16) CCSID 280),
CAST(MRLIB AS CHAR(10) CCSID 280),
CAST(MROBJ AS CHAR(10) CCSID 280)
FROM $LNKLIB.MRMOBJP order by MRLIB, MROBJ";
$stmt = db2_exec($dbh, $sql, array('cursor' => DB2_SCROLLABLE));
print '<table>';
while ($row = db2_fetch_array($stmt))
{
if(!$row=="") {
$costumerMRJID = $row[3];
$costumerMRLIB = $row[4];
$costumerMROBJ = $row[6];
?>
<tr>
<td width="120" bgcolor="#CCCCCC"><font face="Times New Roman"> <?php echo($costumerMRJID);?></font></td>
<td width="140" bgcolor="#CCCCCC"><font face="Times New Roman"> <?php echo($costumerMRLIB);?></font></td>
<td width="120" bgcolor="#CCCCCC"><font face="Times New Roman"> <?php echo($costumerMROBJ);?></font></td>
<?php
}
}
print '</table>
';
Ciao grazie