Re: 3-Way Table Join....Running sloowwww, Any ideas?? - telnet.cap (0/1)
Posted in 1996
Whenever you have an OR in the syntax check whether you can break the SELECT
down into a UNION e.g.
select * from customer
where custno = "FRED"
or open_date >= "010195"
If you have an index on custno and open_date which one does it use?
Rather try
select * from customer
where custno = "FRED"
union
select * from customer
where open_date >= "010195"
This will use both indexes. Also, don't use between on dates. I'm sure
somebody can tell me why but I find it is a dog. We try and favour
select * from customer
where open_date >= "010195"
and open_date <= "311295" rather than BETWEEN.
We have to live with the syntax coming out of CONSTRUCT but life's not
perfect OK!
----------------------------------------------------------------------------
Neil Emerick @ Mach 4 Southern Africa - Tel : 27 11 807 3926
----------------------------------------------------------------------------