Re: How can I tune this query?????

From: Charles Dye <cdye_at_dnt.dialog.com>
Date: 1996/03/27
Message-ID: <4jc6k3$5ee_at_iserv.dnt.dialog.com>#1/1


Andrea,

One thing that will most likely work faster is to rewrite the query as follows:

	select id from cat c
	where exists (select keyval from dates d
	              where year=1965 AND d.keyval=c.keyval)
	/
	

Regards,
Charles_Dye_at_corp.dialog.com

In article <4jbpgi$ets_001_at_nuts.nwu.edu>, aboyes_at_nwu.edu (Andrea J Boyes) writes:
> I have a query:
>
> select id from cat
> where keyval in
> (select keyval from dates
> where year = 1965);
>
> This takes < 5 seconds running against the 300,000 row tables.
>
> When I change the "=" to ">",
> select id from cat
> where keyval in
> (select keyval from dates
> where year > 1965);
>
> the query takes 2 minutes.
>
> Andrea J Boyes
> Northwestern University, Evanston, IL. USA
> aboyes_at_nwu.edu

-- 
Charles_Dye_at_corp.dialog.com
Received on Wed Mar 27 1996 - 00:00:00 CET

Original text of this message