Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL Query with a little bit more complicated WHERE clause performance issue

$
0
0

Hello, I have some performance issue in this case:

Very simplified query:

SELECT COUNT(*) FROM Items
WHERE
 ConditionA OR
 ConditionB OR
 ConditionC OR ...

Simply I have to determine how many Items the user has access through some complicated conditions.

When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only 10 Items from 100,000.

How can I improve the performace in this "Get my items" case?

Additional information:

  • the query is generated by EF 6.1
  • MS SQL 2012 Express

Here is the main part of the real SQL Execution Plan:



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>