|
Posted by David Portas on 03/31/06 15:47
chudson007@hotmail.com wrote:
> David,
>
> Unfortunately I'm working with data exttracts as opposed to a well
> designed system.
> The code below demonstrates what i am trying to do.
> In TableA My_ID is is either Null or a unique number.
> In TableB My_ID is either Null or a number which may not be unique.
>
> I tried using a full outer join the other day, but after 15 hours it
> still had not worked so I think I am doing somethiing wrong and need
> help.
>
> In my real data TableA contains just under 2 million records 1.2million
> of which My_ID is null and TableB conatins 5million records of which
> almost 3 million of which My_ID is null.
>
I can see that the system isn't well designed. What I'm suggesting is
that you fix it. I assume what you mean by "data extracts" is that you
are importing some data into a database from an outside source over
which you don't have any control. Can't you create your own tables and
import the data into them? That's what I recommend: convert your source
data into a normalized data model BEFORE you attempt any further
processing. You obviously haven't done that yet and I don't understand
what you are trying to achieve with this FULL JOIN. Why would you want
to return a join consisting of 7 million rows?
If you aren't permitted to implement a better design then maybe you'll
have to live with sub-optimal performance. I can't redesign your tables
for you because I don't know what your data means or what the result
you've asked for means.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Navigation:
[Reply to this message]
|