SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to retrieve all the columns from External list from sharepoint 2010. Em using the below code

 SPListItemCollection collection = list.GetItems(query);

   foreach (SPField field in collection[0].Fields)


Here collection[0].Fields takes so much time. How can I avoid this perofrmance problem? Is there way of faster retrieval of items?

share|improve this question
do you have possibility to use LINQ? – Falak Mahmood Jun 9 '12 at 10:27
Yes. I see that the first access to SPListItemCollection object takes lot of time like 10-15 seconds in my case just to retrieve 5 items from list. What can be done to avoid this? – sharmila Jun 9 '12 at 10:41
have you used CAML to get the items collection? – Falak Mahmood Jun 9 '12 at 10:48
yes.. I am using CAML to get the collection . SPQuery query = new SPQuery(); query.Query ="<Where><IsNotNull><FieldRef Name='BdcIdentity'/></IsNotNull></Where>"; SPListItemCollection collection= list.GetItems(query); foreach (SPField field in collection[0].Fields) { //System.Diagnostics.Debug.Write(field.Title.ToString()); } Here first access to collection[0].Fields is very slow – sharmila Jun 9 '12 at 10:52
You have to include the fields you use in the code in the ViewFields node of the CAML query as FieldRef. Are you specifying RowLimit? – Falak Mahmood Jun 9 '12 at 10:55
up vote 1 down vote accepted

BCS is a service application, and hence some WCF service calls will be involved. I don't think so CAML/SPList or LINQ will cause any good to improve performance, especially if external list is big. But to gain a huge performance impact it is best to define either a SpecificFinder-method to perform direct SQL-query or to add an Filter to the Finder-method to improve performance.

See more details:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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