Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Tough query

Re: Tough query

From: Alan <alan_at_erols.com>
Date: Tue, 18 May 2004 13:10:35 -0400
Message-ID: <2guuapF71palU1@uni-berlin.de>


Try this:

SELECT COUNT(*) FROM
(
SELECT custid, edate
FROM dbw_promoc
MINUS
SELECT custid, edate
FROM promo_at_report
)
;

"Sashafay" <afayfman_at_mwh.com> wrote in message news:a13f8a22.0405180650.48e79eea_at_posting.google.com...
> Need a little help with tuning of my query. The following select
> statement going to compare two tables for missing records. One of the
> table local and the other remote. There is any hints exist for remote
> databases?
>
> SELECT
> COUNT(A.CUSTID)
> FROM
> DBW_PROMOC A
> WHERE NOT EXISTS
> (SELECT 'X' FROM PROMOC_at_RPT B
> WHERE A.CUSTID = B.CUSTID AND A.PROMO = B.PROMO AND A.EDATE =
> B.EDATE);
>
> NOTE: This query takes over an hour to run, even all three fields are
> Primary keys in both tables.
>
> A little bit more info about my query: local database 9.0.1 and CBO,
> but remote is 7.3.4 and RBO. Both table have over 23 millions records.
> Execution plan force to do INDEX FAST FULL SCAN.
>
> Thanks in advance,
> Alex
Received on Tue May 18 2004 - 12:10:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US