Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why this DELETE is so slow?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00988740
Message ID:
00988752
Vues:
40
Andrew,

Try in VFP9
DELETE Resource FROM Resource ;
  JOIN Task ON Resource.Taskid = Task.Id 
  WHERE Task.MainId = 12345
>Having performance issues with this command:
>
>DELETE FROM Resource WHERE TaskId IN (SELECT id FROM Task WHERE MainId = 12345)
>
>It takes about 7 sec to run when in "multi-user environment", which is emulated by simply opening the tables in question from 5 VFP instances with no real traffic.
>Tables have about 20K records each.
>All index tags are present, however SYS(3054) reports that TaskId tag on Resource table is not used.
>
>Tried this in VFP9 with the same results:
>
>DELETE Resource FROM Task WHERE Resource.Taskid = Task.Id AND Task.MainId = 12345
>
>
>Meanwhile this works REAL fast:
>SELECT id FROM Task WHERE MainId = 12345 INTO ARRAY aTemp
>FOR EACH iTaskId IN aTemp
> DELETE FROM Resource WHERE TaskId=m.iTaskId
>ENDFOR
>
>So I figured it must be the "2nd join" issue, like in
> Select * from A Join B ... Join C ...
>where VFP can optimize only the first Join but not the 2nd one because it has to deal with an intermediary cursor. Or something like that. BTW what about this and all the improvements in VFP9?
>
>But contrary to my "figuring out" this also works fast:
>SELECT * FROM Resource WHERE TaskId IN (SELECT id FROM Task WHERE MainId = 12345)
>despite the fact that SYS(3054) reports no optimization on Resource table.
>
>My next guess is it has something to do with how vfp performs updates in the "multi-user" environment, but I don't know where to start...
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform