Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Efficient SQL
Message
 
 
À
02/10/2014 17:11:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01608703
Message ID:
01608705
Vues:
60
>Hi All:
>
>The following SQL takes 5 seconds to run. Is there any way to speed it up?
>
>I should mention that on my local machine it runs very quickly. The problem is when I run this on the user's network.
>
>Note that line_close is a field in the poline table.
>
>
>SELECT 'P' sqcType, reqrd_date sqdDate, ;
>	ord_qty - recv_qty sqnQty, 0000000 sqnRunning,  ;
>	' ' sqcIgnore ;
>	FROM a_poline pl ;
>	WHERE Item_no = tcItem ;
>	AND pl.ord_qty > pl.recv_qty ;
>	AND !line_close ;
>	UNION ALL ;
>	SELECT 'S' sqcType, sh.canc_date sqdDate, ;
>	qty * -1 sqnQty, 0000000 sqnRunning,  ;
>	' ' sqcIgnore ;
>	FROM a_lineitm li ;
>	INNER JOIN a_sohead sh ;
>	ON li.so_no = sh.so_no ;
>	WHERE Item_no = tcItem ;
>	AND (sh.STATUS = 'S' OR sh.STATUS = 'b') ;
>	ORDER BY 2, 1 ;        &&Date
>INTO CURSOR curRunning READWRITE
>
>
>Thanks,
>
>Yossi

You can move last condition on sh status table into the JOIN, e.g.
ON a_sohead sh ON li.so_no = sh.so_no and sh.Status IN ('S','b')

I don't think it'll speed it up. Do you have indexes on JOIN conditions and on item_no column?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform