June 7, 2013 at 9:45 am
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.
June 7, 2013 at 9:52 am
vs.satheesh (6/7/2013)
i am using CTE in following wayswith 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
June 7, 2013 at 1:42 pm
vs.satheesh (6/7/2013)
My question isI 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?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply