Viewing 15 posts - 1,981 through 1,995 (of 59,099 total)
oh god no don't use UNION ALL unless you really need to. Why not just something like this to get all the records you need from each source?
INSERT INTO...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2023 at 5:50 am
As I said second option is still used but it's slow. @pietlinden
@jeff Moden: which requires a union all? 😅 , No thx
As opposed to what??? The (in your own...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2023 at 5:43 am
Michael, have you seen the movie Idiocracy? If not, just look around. AI is just another way for it to come true.
I hear about how good that movie was...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2023 at 12:35 am
I guess you mean selecting them with union all, that's even worse performance wise.
It does.
No... and no where did I come close to even inferring that. I mean use...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2023 at 12:31 am
I don't have access to SQL 2022, but I would think that a windowed function would perform much better than the CROSS APPLY.
Really good point on using a Windowing...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2023 at 12:15 am
If all the databases are on the same instance, why do you need to use a temporary table?
Also, does your temporary table actually have the correct indexes on it?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 9:02 pm
perfect, thanks
Yes, I'd defined VALUES incorrectly - typing rather than cut and paste
Just to be sure, are you all set now?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 8:08 pm
And thanks for the reminder that I should probably publish the testing I did for that.
In truth, I need to do my own testing on it as well....
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:37 pm
Nope... not missing those points at all. Those are the points that I'm actually afraid of because the folks that need to use it are going to believe its "correct"...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:25 pm
If that's the case, the OP could make use of GENERATE_SERIES as (based on your recent findings, Jeff), it's performant for a single series, which the OP seems to...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:14 pm
And, wow... Phil Carter. Were did you ever get off to?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:06 pm
Look into LAG.
https://learn.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-ver16
You could also do a "rolling average" using AVG() OVER but it would likely be much more expensive to do it that way.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:03 pm
Ok... since SPAM keeps necroing this 2 decade old thread and someone might read it and without knowing what the cursors are actually being used for, I'll just up and...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 3:00 pm
So where do these linked integers come from? Why, for example, is
1linked to1,2, and3, but the numbers8to14only linked to8?
Apparently,...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 2:54 pm
SSC pulls thru again!
{snip}
Guess who whipped this baby into shape in about 2 days?
Someone who's an obvious and valued resident of the SSC Sanitorium in the DBA Disneyland...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2023 at 2:37 pm
Viewing 15 posts - 1,981 through 1,995 (of 59,099 total)