General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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()
>I have some very large tables from which I have to get records NOT IN other very large tables. Code like this:
>
>select * from table1;
>where keyfield NOT IN;
>(select keyfield from table2)
>
>is not optimizable, and is extremely slow (about 15 minutes or more) for each query. I have tried a SCAN/SEEK, but it is at least as slow or worse, since you're looking for unique keys that don't exist, and therefore must hit every record.
>
>Any ideas for something faster?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only