How can I improve the query by selection multiple fields from joined tables

  • Thread starter Thread starter Najatte
  • Start date Start date
N

Najatte

Hello,

My problem is :
I am trying to join multiple tables and list the only needed fields in the
query result
the query takes less time if I join the tables wihout specifying any fields
from the joined tables
Iexplain :

The below query takes more times (all fields selected from all tables)
SELECT *
FROM T1 LEFT OUTER JOIN T2 on <joined condition>
T1 LEFT OUTER JOIN T3 on <joined condition>

than the query that selects only the fields from the table T1
SELECT T1.*
FROM T1 LEFT OUTER JOIN T2 on <joined condition>
T1 LEFT OUTER JOIN T3 on <joined condition>

My question is how to solve such case since I have to select fields from
more than one tables
I tried the view ....no satisfied response time....

and I am using SQL 2003 & SQL 2005

Thanks for your answer,

Najatte A.
Lebanon - Development Department
 
N> My question is how to solve such case since I have to select fields from
N> more than one tables
N> I tried the view ....no satisfied response time....

select t1.field1, t1.field2, t2.field1, t2.field5, t3.field1, ........
from ........


That said, usually the response time of sql server does not really depend on
the number of columns (there are some special cases though). This delay is
more likely due to the very big amounts of data transfered from the server
to your workstation. You will have success if you specify some criteria for
the extracted records, rather than extracting all of them.

Vadim Rapp
 
Back
Top