Terry,
I did an explain on this query since it seemed to take a long time to run & this is what I got back. I think the DBA's frown on the product joins
Explanation
1) First, we lock a distinct BA_TEMPDB."pseudo table" for read on a
RowHash to prevent global deadlock for BA_TEMPDB.c.
2) Next, we lock a distinct TEMPDB."pseudo table" for read on a
RowHash to prevent global deadlock for TEMPDB.d.
3) We lock BA_TEMPDB.c for read, and we lock TEMPDB.d for read.
4) We execute the following steps in parallel.
1) We do an all-AMPs RETRIEVE step from BA_TEMPDB.c by way of an
all-rows scan with no residual conditions into Spool 2, which
is redistributed by hash code to all AMPs. The size of Spool
2 is estimated with low confidence to be 73,320,048 rows.
The estimated time for this step is 57.15 seconds.
2) We do an all-AMPs RETRIEVE step from BA_TEMPDB.A by way of an
all-rows scan with no residual conditions into Spool 3, which
is redistributed by hash code to all AMPs. Then we do a SORT
to order Spool 3 by row hash. The size of Spool 3 is
estimated with low confidence to be 73,320,048 rows. The
estimated time for this step is 2 minutes and 25 seconds.
5) We do an all-AMPs JOIN step from TEMPDB.d by way of an all-rows
scan with no residual conditions, which is joined to Spool 2 (Last
Use). TEMPDB.d and Spool 2 are joined using a product join, with
a join condition of ("ACCOUNT1 = TEMPDB.d.ACCOUNT_NO"

. The
result goes into Spool 4, which is built locally on the AMPs. The
result spool file will not be cached in memory. The size of Spool
4 is estimated with index join confidence to be 29,914,579,584
rows. The estimated time for this step is 19 hours and 28 minutes.
6) We do a SUM step to aggregate from Spool 4 (Last Use) by way of an
all-rows scan, and the grouping identifier in field 1. Aggregate
Intermediate Results are computed locally, then placed in Spool 6.
The aggregate spool file will not be cached in memory. The size
of Spool 6 is estimated with no confidence to be 26,923,121,626 to
29,914,579,584 rows.
7) We do an all-AMPs RETRIEVE step from Spool 6 (Last Use) by way of
an all-rows scan into Spool 5, which is built locally on the AMPs.
Then we do a SORT to order Spool 5 by row hash. The result spool
file will not be cached in memory. The size of Spool 5 is
estimated with no confidence to be 26,923,121,626 rows.
8) We do an all-AMPs JOIN step from Spool 3 (Last Use) by way of an
all-rows scan, which is joined to Spool 5 (Last Use). Spool 3 and
Spool 5 are joined using an inclusion merge join, with a join
condition of ("(ACCOUNT1 = ACCOUNT1) AND (EXACT_DISTANCE = Field_3)"

.
The result goes into Spool 8, which is built locally on the AMPs.
The size of Spool 8 is estimated with index join confidence to be
73,320,048 rows. The estimated time for this step is 1 hour and 9
minutes.
9) We do an all-AMPs JOIN step from TEMPDB.B by way of an all-rows
scan with no residual conditions, which is joined to Spool 8 (Last
Use). TEMPDB.B and Spool 8 are joined using a product join, with
a join condition of ("ACCOUNT1 = TEMPDB.B.ACCOUNT_NO"

. The
result goes into Spool 1, which is built locally on the AMPs. The
result spool file will not be cached in memory. The size of Spool
1 is estimated with index join confidence to be 29,914,579,584
rows. The estimated time for this step is 4 hours and 20 minutes.
10) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 1 are sent back to the user as the result of
statement 1.
QueryMan