Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Improving sluggish SQL
Message
De
20/12/1999 14:16:44
 
 
À
20/12/1999 13:36:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00306158
Message ID:
00306333
Vues:
36
>>>I know I'm going to catch hell for suggesting using the deleted mark but this will work fast.
>>>
>>>DELETE FROM table1 WHERE keyfield IN (SELECT keyfield FROM table2)
>>>SELECT * FROM table1 WHERE !DELETED()
>>
>>Actually that's a rather clever idea, and there are no deleted records in these tables, so that is not an obstacle for this idea.
>>
>>The problem is doing RECALL ALL later - that may take a long while, and I don't want to do a COPY TO here. But I will test it along with Walter's idea, to see how these ideas go...
>
>You make a good point about RECALL ALL. How about this:
>
>SELECT * from table1 INTO CURSOR whatever NOFILTER
>USE DBF('whatever') AGAIN IN 0 ALIAS canedit
>DELETE FROM canedit WHERE keyfield IN (SELECT keyfield FROM table2)
>SELECT * FROM canedit WHERE !DELETED()
>Then just abandon the whatever/canedit cursor and you don't have to recall anything.
>
>The added benefit of this is you can use it even if there are deleted records in table1 (contingent on the status of SET DELETED, of course). I would be curious to know if these two SELECTs and one DELETE FROM are faster than SELECT FROM ... WHERE ... NOT IN ...


Or Just turn buffering on for table1 and do a tablerevert() within a begin/end transaction so that no changes get saved back to the table.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform