Join Joey D'Antoni for an in-depth discussion in this video Why while loops are cursors, part of SQL Server Performance for Developers.
- [Instructor] In talking talking about set versus…real based operations, one common myth we run into…is that WHILE loops may be faster than cursors…or they operate very differently than cursors.…And this simply just isn't the case.…The only real advantage WHILE loops have over cursors in SQL…server is that the code is a little bit simpler to run.…But let's talk about of the myths…that are associated with these comparisons.…Its fairly common if you read internet forums on SQL…or Stack overflow that you'll see that instead…of doing a cursor, a developer will frequently say,…hey, I'll do a WHILE loop cause I've heard cursors…are bad and surely WHILE loops are faster.…
A couple of examples here, some common sentiments…that WHILE loops will perform better than cursors…and that's simply not true.…The performance and the functionality and the operations…that are taking place under the hood are really the same.…And another example is the code…is easier to write than a cursor.…That may be the case.…A WHILE loop usually has a simpler code…
- Query execution
- How to read an execution plan
- What not to do with SQL Server
- Why cursors are bad
- Why scalar UDFs are expensive
- Datatypes and design
- What is a columnstore index?
- Transaction isolation
Skill Level Intermediate
1. Query Execution
2. What Not to Do with SQL Server
3. Datatypes and Design
4. Temporary Objects
7. Isolation Levels
Next steps2m 15s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.