No video

What’s The Point of 1 = (SELECT 1) In SQL Server Queries?

  Рет қаралды 2,684

Erik Darling

Erik Darling

Күн бұрын

Пікірлер: 15
@bbksvb
@bbksvb Ай бұрын
I was wondering about this. Thanks for the info!
@ErikDarlingData
@ErikDarlingData Ай бұрын
There you go!
@christopherstyle878
@christopherstyle878 Ай бұрын
Mezcal and brisket, got it.
@ErikDarlingData
@ErikDarlingData Ай бұрын
It’s a fairly simple checklist
@douglascoats7081
@douglascoats7081 Ай бұрын
When dealing with wonky nonsense in plans, Instead of WHERE 1 = (SELECT 1), I smack the monitor and then blow in the USB port.
@ErikDarlingData
@ErikDarlingData Ай бұрын
Throw the controller against the wall
@mortezasafaee6981
@mortezasafaee6981 Ай бұрын
Keep going... i like you haircut😊
@ErikDarlingData
@ErikDarlingData Ай бұрын
Thank you 😁
@worldfromtheair
@worldfromtheair Ай бұрын
Slightly off topic, but I guess you also use DATA_COMPRESSION = PAGE on all your index creates too? I guess just to save space and logical reads
@ErikDarlingData
@ErikDarlingData Ай бұрын
Just space. I don't care about logical reads: kzbin.info/www/bejne/oanadp6bd6iVmqc
@IcarianHeights
@IcarianHeights Ай бұрын
Apologies for being dense, but even after watching the video and reading the blog post, though I better understand why you're using `1 = (SELECT 1)`, I still don't understand why that pattern forces the optimizer to skip assigning the query as having a `trivial plan` or `simple parameterization`. Is it simply because it's a sub-query, where the optimizer doesn't know what may be in it at runtime so it has to in fact go down the actual road of optimizing the query further than if it were a known/constant value?
@ErikDarlingData
@ErikDarlingData Ай бұрын
Yep, you can even simplify it in some cases to be something like SELECT (SELECT Id) FROM dbo.Whatever;
@andreysamykin1143
@andreysamykin1143 Ай бұрын
Thanks for an interesting video! I wonder if “when 1=1” has the same effect.
@ErikDarlingData
@ErikDarlingData Ай бұрын
I’m not sure I follow this one
Five Reasons Why Your SQL Server Is Slow Right Now
24:04
Erik Darling
Рет қаралды 1,8 М.
Performance Tuning TOP PERCENT Queries In SQL Server
18:49
Erik Darling
Рет қаралды 881
At the end of the video, deadpool did this #harleyquinn #deadpool3 #wolverin #shorts
00:15
Anastasyia Prichinina. Actress. Cosplayer.
Рет қаралды 2,8 МЛН
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 20 МЛН
Turns out REST APIs weren't the answer (and that's OK!)
10:38
Dylan Beattie
Рет қаралды 152 М.
Database Indexing for Dumb Developers
15:59
Laith Academy
Рет қаралды 54 М.
SQL Indexes Explained in 20 Minutes
19:31
developedbyed
Рет қаралды 9 М.
In Memory Table Variables In SQL Server: Still Pretty Stupid
21:01
A Bug When Mixing datetime and datetime(2) Data Types
11:28
Erik Darling
Рет қаралды 455
SQL performance tuning and query optimization using execution plan
49:23
A Little About Index Compression In SQL Server
18:29
Erik Darling
Рет қаралды 541
At the end of the video, deadpool did this #harleyquinn #deadpool3 #wolverin #shorts
00:15
Anastasyia Prichinina. Actress. Cosplayer.
Рет қаралды 2,8 МЛН