The simple thing to do would be to time both of them.

But in general (and this can easily change depending on the DBMS you use) I
would say that the first (a simple join) would be faster than the second (a
sub-select).  Just make sure that you're join columns are indexed for best
performance.

Jim Davis

  _____  

From: Robert Everland III [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 11, 2004 8:28 AM
To: CF-Talk
Subject: SQL Performance Question best practive

Which would be faster

Select users.username,
       project.projectname
From   users inner join project on (users.userid = project.projectowner)

- Or -

Select (select username from users where userid = project.projectowner),
        project.projectname
From   project

Bob

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to