Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Time out Expired Expand / Collapse
Author
Message
Posted Friday, June 7, 2013 9:45 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 6:10 AM
Points: 61, Visits: 390
i am using CTE in following ways


with CTE1
(
select * from xx
),
CTE2
(
select * from test inner join CTE1 CT on test.id=CT.id
) ,

CTE3
(
select * from yyyy
)


select * from CTE1
inner join CTE2 on CTE1.od=CTE2.id
inner join CTE3 on CTE3.id=CTE1.id



My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.
Post #1461141
Posted Friday, June 7, 2013 9:52 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:51 PM
Points: 12,910, Visits: 32,026
vs.satheesh (6/7/2013)
i am using CTE in following ways


with CTE1
(
select * from xx
),
CTE2
(
select * from xx a inner join CTE1 CT on xx.id=CT.id
) ,

CTE3
(
select * from yyyy
)


select * from CTE1
inner join CTE2 on CTE1.od=CTE2.id
inner join CTE3 on CTE3.id=CTE1.id



My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.



well, it looks to me like your pseudo code doesn't show us enough;
CTE2 would fail because the column names are not unique, since you are selecting from the same table [xx] twice

can you show us either the real sql you are using, or a find-and-replace obfuscation, instead?



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1461144
Posted Friday, June 7, 2013 1:42 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 28, 2014 11:45 AM
Points: 185, Visits: 924
vs.satheesh (6/7/2013)
My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.
Have you looked at execution plans already?



Alex Suprun
Post #1461210
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse