February 3, 2016 at 5:28 am
Hey everyone! I'm having a slight problem with the Union Template. When I try previewing the LEARN MORE button so the lightbox appears and the contact us form pops-up, it doesn't show the full rectangle around the form nor does the text fit in the form fields. What can I do to fix this? Thanks so much! VMware Training in Chennai π | Web Designing Training in Chennai π
February 3, 2016 at 5:33 am
SQL006 (2/3/2016)
Thank you guys for your valuable inputs. I checked the execution plan for the UNION and the CROSS APPLY query, i am surprised that the UNION query is still faster than CROSS APPLY query by 1-2 seconds,even though in UNION query it accessing the table twice in comparison to CROSS APPLY where it accessing the table only once.For the execution order of query i referred the itzik ben-gan logical order processing.
Thanks for all your suggestions.
That's an interesting and unexpected observation. Care to share your code?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 3, 2016 at 8:07 am
It might be caused by how the date ranges are handled. The union might allow to get a more straight forward plan.
Maybe if you combine the solutions, you could get better performance.
SELECT
t.Id,
x.Amount,
t.CashFlowDate,
x.AmtType
FROM #Test t
CROSS APPLY (
VALUES
(t.Principal, 'Principal'), --No need for additional date condition
(CASE WHEN t.CashFlowDate >= '2016-01-02' THEN t.Interest END, 'Interest') --Exclude the first day
) x (Amount,AmtType)
WHERE x.Amount > 0
AND CashFlowDate between '2016-01-01' AND '2016-01-05'; --Leave a single date condition
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply