mauro21pl Posted February 28, 2008 Share Posted February 28, 2008 HiI have two table and three queries. The output of the queries is exactly the same. I am using join, IN and EXIST. Well I will give you the codes of it:Query01SELECT DISTINCT Owner.* FROM Owner, MemberWHERE Owner.userid=Member.userid;Query02SELECT * FROM OwnerWHERE userid IN (SELECT userid FROM Member);Query03SELECT * FROM OwnerWHERE EXISTS (SELECT * FROM Member where Owner.userid = Member.userid);I know I can use index on userid to make it run faster. Are there any other ways to make the query run faster? Could I change anyything in the codes so it will output the same results but with more efficient way making the query run fasterThx Link to comment Share on other sites More sharing options...
justsomeguy Posted February 28, 2008 Share Posted February 28, 2008 That's a pretty basic 2-table 1-column join, there's not a lot you can do to improve the query. Just make sure you keep the tables optimized, and it would be good to make indexes on both columns in both tables. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.