syntax - SQL efficiency - [=] vs [in] vs [like] vs [matches] -


Just out of curiosity, I was wondering if there was no speed in using [[code> = vs [[code> in ] versus [ as ] vs [ matches ] (for only 1 value) syntax for SQL

  Select the field from the table where the field = value;  

vs

  Select the field from the table where the value (value) in the field;  

versus

  Select the field from the table where the value-like fields;  

versus

  select the fields that match the fields field;  

A will also add to it and sub query.

But this performance depends on the optimizer of the SQL Engine.

In Oracle you have a lot of difference between IN and EXISTS, but it is not necessary in SQL Server.

The second thing you have to think about is the selection of the column that you use. Some cases show that these are better.


But you have to remember that IN is nonsargable (enable non-search logic) so that = < Strong> = = and index support


Best?

You should spend some time testing it in your environment

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -