Avoiding subqueries in SQL for big gains(thebrainparasite.com)

submitted by UnicornNinjaUnicornNinja(465) 4 years, 1 month ago

Some people are just unaware of the alternatives to performing a sub query. The performance gains can be substantial if you put the database engine to use!

2 comments |category: |Views: 103

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by mrkurtmrkurt(280) 4 years, 1 month ago 0

You know, articles like this are painfully useless without any kind of look at what the DB does to optimize queries. His example query is so braindead as to be useless, though I'm mildly surprised that MySQL doesn't optimize it to something smarter.

In many cases, SQL Server will use the exact same execution plan for equivalent subquery and join based selects.

Reply

posted by UnicornNinjaUnicornNinja(465) 4 years, 1 month ago 0

Speaking of brain dead, at least I can form complete sentences. Also, SQL Server will not perform the same execution plan for sub queries beyond the simplest scenario. wonk wonk

Reply

information Login or create an account to comment on this story