Home > database >  Sqlserver2008 query where conditions have special slow or lead to the query
Sqlserver2008 query where conditions have special slow or lead to the query

Time:09-18

The SELECT A.S UID AS SUID, Anderson, UID AS SeriesUID, A.S Number, B.I UID AS IaeUID
FROM A INNER JOIN B
ON Anderson, UID=B.S eriesIUID
Where A.S UID='1.2.276'
The or A.S UID in
(Select SUID from C where MergeSUID='1.2.276')
Index should be behind the or not go, index, field are set up in the where clause for no or no problem, or will instead of behind the or A.S UID in (' 11 ', '33) is also no problem, what a great god can, under the guidance to the union all is no problem, I now want to solve in the case of using the or to speed up the query

CodePudding user response:

That is good in a small number of cases

CodePudding user response:

This change is not big, give it a try?
 SELECT A.S UID AS SUID, 
Anderson, UID AS SeriesUID,
A.S Number,
B.I UID AS IaeUID
FROM A
INNER JOIN B
ON Anderson, UID=B.S eriesIUID
WHERE A.S UID (IN the SELECT '1.2.276 AS suid
UNION ALL
SELECT the SUID
The FROM C
WHERE MergeSUID='1.2.276')

CodePudding user response:

Nobody to maintain the old system, don't change the statement, how can in the case of not statements, accelerate query speed, the index view I also tried, very slowly,

CodePudding user response:

How in the case of red light traffic dense in the pavement and don't have an accident?

No immortal and the devil, what all don't want to change, not according to the rules to affirmation is problematic,
  • Related