Re: How to speed up this query?

From: Cheryl Riley <101520.1306_at_CompuServe.COM>
Date: 1996/02/22
Message-ID: <4giimi$qfh$1_at_mhafc.production.compuserve.com>#1/1


>>select distinct view1.i_mfr_id, view1.i_mfr_des,
>> view1.c_code, tablex.c_code
>>from view1, tablex
>>where view1.c_code = tablex.c_code;

Have you checked the SQL in the view to make sure this isn't what's causing your problem? If so, you could try this :

select view1.i_mfr_id, view1.i_mfr_des,

        view1.c_code, tablex.c_code
from view1 a, tablex
where view1.c_code = tablex.c_code
and not exists (select null

		from   view1 b
		where b.i_mfr_id=a.i_mfr_id 
		and b.i_mfr_des=a.i_mfr_des
		and b.c_code=a.c_code
		and b.rowid>a.rowid)

This will avoid the internal sort BUT is not recommended unless the subquery is driven by a strong index.

Cheryl Received on Thu Feb 22 1996 - 00:00:00 CET

Original text of this message