Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Improving sluggish SQL
Message
From
21/12/1999 12:27:11
 
 
To
20/12/1999 14:16:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00306158
Message ID:
00306761
Views:
32
>>>>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.

Please show me how this is done. I've tried several different methods without success. What type of buffering on table1. Each time I've tried it the SELECT was ineffective. It selected all the records from table1, not just those that I had deleted in the DELETE FROM command. I would really appreciate a code snippet. Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform