0

Following query i write it returns me 1400 records. and below line taking much time.

1.5 second taken by

count = quer != null ? quer.Count() : 0;

and 2 sec taken by

candidateList = quer.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();

Please suggest.

1

The LINQ tools are very handy for developers, but they were never guaranteed to perform better than ugly CAML code or be more resilient to user changes (hint: they rely on display names that may change), for that matter.

Look into ULS logs (Set-SPLogLevel -Trace Verbose) for answers in the Database category.

Moreover, I assume you're doing this from a Console executable on a development machine, right?

Try SQL Server Management Studio's profiler or other tools to understand what's the load on SQL Database, how are the indexes/indices and execution plans (mis)used. Sometimes you might find useful to check for database fragmentation.

  • No ,i am not using console.Is there any other code that can be replace it. – Jon Nov 13 '14 at 15:13
  • ((SPList)list).GetItems((SPQuery) query).Count for the first line. Of course, you should build a proper query first. – Alexey Krasheninnikov Nov 13 '14 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.