sql - Why is it that the IsEqual (=) operator is working faster than the IsNotEqual (<>) operator in Oracle? -


Like the title, if anyone has an answer then I want to know. I've been googling, but did not get a direct answer

Example:

This works

  SELECT1 (*) to Table 1 TB1, Table 2 TB2 Where TB 1.Field 1 = TB 2.Table2  

This may take time

  SELECT COUNT (*) to Table 1 TB1, Table 2 TB2 Where TB1 Field 1 & lt; & Gt; It is important to realize that SQL is a declarative language and is not mandatory. One. You tell that in which situation you want to fit your data and not how those comparisons should be performed. This is the job of the database to find the fastest way to give you an answer (taken by a task). This means that your query appears that small changes can result in a wildly different query plan, which In turn, results in a wildly different runtime behavior.  

= Comparison can be changed, adapted and customized in the same way as easily joining the two areas. This means that general indices can be used to execute queries quickly, possibly reading actual data and instead using index only.

A & lt; & Gt; The second hand is completely calculated and checked for this condition, usually (it can be a method of optimizing with the correct index, but usually there is an index here Will not help) This will usually return a lot of results, which adds to the execution time.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -