Forum Discussion
joshAU
Mar 29, 2023Copper Contributor
SQL queries have become extremely slow compared to nearly identical queries on the same tables
Hi all. I've been drafting a SQL query from within MS SSMS, as a .SQL file, and then running it from within SSMS, on the same system that is running the 2019 developer edition server. The query fil...
olafhelper
Mar 29, 2023Bronze Contributor
joshAU wrote:similar queries ... or so ... may be ...
joshAU , that are more then vague information.
Compare the execution plans and may share them via Paste The Plan - Brent Ozar UnlimitedĀ®
joshAU
Mar 29, 2023Copper Contributor
Hiolafhelper
Thanks for your advice, and sorry if some of my question sounded vague.
I did not actually say "similar queries" or say "may be", that you are quoting me as saying.
I did say the "query file contains around 100 or so queries", and "the last 10% or so".
I did not feel the exact number of queries was relevant to the question, as I was not concerned about the duration of ALL queries, but rather the duration of a few specific queries.
I did actually include both execution plans in the original question, via the link I posted to the brentozar webpage here: Execution plan
I have just realised that the slowness only occurs with the final AND clause:
and T1.Zdate < database1.dbo.SUMMARYTABLE.Zdate
If I remove that, or manually type in a static date, eg. '2023-12-01', instead of the SUMMARYTABLE.Zdate, the query finishes in a second or so.