Very slow
- From: d.wiss@xxxxxxx
- Date: Wed, 20 Jun 2007 07:31:07 -0700
Hi all
Assume there are two tables with each 2 columns. TableA has 3000 rows
and TableB has 30'000 rows and each row of TableA.Col1 is linked as a
foreign key to TableB.Col1. Primary keys, indexes etc are all well
done.
Now I want to find out if there are some items in TableA which ARE NOT
found in TableB (zombie records). I know this shouldn't happen but
there are...
So I do following query:
SELECT DISTINCT TableA.Col1, TableB.Col1 FROM TableA
LEFT OUTER JOIN TableB ON TableB.Col1 = TableA.Col1 WHERE TableB.Col1
IS NULL
In case there is a zombie record it will look like:
TableA.Col1 TableB.Col1
====================
1234 NULL
If I let run this query on MSDE it is very fast.
If I let run this query in VS 2005 on a Compact Edition database it is
veeeeery slow. It takes aprox. 1 minute and the CPU is 100%.
Has someone an explanation? Or better: has someone a better solution?
Thanks
Daniel
.
- Follow-Ups:
- Re: Very slow
- From: William \(Bill\) Vaughn
- Re: Very slow
- Prev by Date: Create an index on a table unless it already exists
- Next by Date: Re: Very slow
- Previous by thread: Create an index on a table unless it already exists
- Next by thread: Re: Very slow
- Index(es):
Relevant Pages
|
Loading