Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6715957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:40:33+00:00 2026-05-26T08:40:33+00:00

I am turning some stored procedure to vb.net linq (SQL to linq …. manually)

  • 0

I am turning some stored procedure to vb.net linq (SQL to linq …. manually) because stored procedure is slow.

I am using linq queries in concurrent threads.

After running a performance analyzing, I find out the linq seems to lock the source collection(like cache.IPMS_TBL_EL_PRICE_COMPONENT in the code period below) when querying.

Is it true? Is there a (not_lock/lock) option for linq?
I really don’t want the collection to be locked. It will slow the multi-thread query.

Thank you very much.

Code period:

see in https://i.stack.imgur.com/YLlI6.jpg or see below

insert0 = (From PPC In cache.IPMS_TBL_EL_PRODUCT_PRICE_COMPONENT_MAPPING
                           From PC In cache.IPMS_TBL_EL_PRICE_COMPONENT
                           Join LK In cache.IPMS_TBL_LOOKUP
                             On PC.Component_Type_Id Equals LK.Lookup_Id
                           Where (PC.Component_Id = PPC.Component_Id OrElse PC.Component_Type_Id = CC3_ID) _
                             AndAlso LK.Commodity_Id = ELE_COMMODITY_ID _
                             AndAlso LK.Lookup_Type.ToLower = PRICE_COMPONENT_TYPE.ToLower _
                             AndAlso PPC.Product_Id = IN_PRODUCT_ID _
                             AndAlso PPC.Price_Type_Id = IN_PRICE_TYPE_ID _
                             AndAlso PC.Is_Deleted = 0 _
                             AndAlso LK.Lookup_Id > MINUS_HUNDRED _
                             AndAlso PC.Component_Id > MINUS_HUNDRED _
                             AndAlso lookupValues.Contains(LK.Lookup_Value.ToLower) _
                             AndAlso (Not PC.ISO_Id.HasValue OrElse Not deletedISO.Contains(PC.ISO_Id.Value))
                           Select New PriceComponents() With {.ComponentID = PC.Component_Id,
                                                              .ComponentName = PC.Component_Name,
                                                              .ComponentTypeID = PC.Component_Type_Id,
                                                              .ComponentTypeName = LK.Lookup_Value,
                                                              .Sequence = PC.Sequence,
                                                              .OrderSequence = orderSequeceDict(LK.Lookup_Value.ToLower),
                                                              .IsMTM = PC.Is_MTM,
                                                              .UcapUsageFactorUnitPrice = PC.UCAP_Usage_Factor_UnitPrice,
                                                              .Percentage = PERCENTAGE}
                           ).OrderBy(Function(e As PriceComponents) e.OrderSequence).ThenBy(Function(e As PriceComponents) e.Sequence) _
                           .Distinct(New PriceComponentsComparer_PK_9_Fields).ToList
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:40:34+00:00Added an answer on May 26, 2026 at 8:40 am

    You are calling ToList which causes the query to evaluate eagerly (there and then).

    With ToList, it will iterate over the result set returning the requested results – this will indeed use the current thread.

    You can defer evaluation by not calling ToList and only evaluate when you actually need to iterate over the results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some problems turning the SQL below into a Zend Db query.
My question is what is best practice to optimize performance using LINQ for SQL
I just need some help to finish turning this SQL : SELECT us.name, pt.task,
I'm losing some hair over Google's AJAX API currently. What I do is turning
I talked my team into turning on compiler warnings again. Some how all warnings
So I'm attempting to use a queue to parse some input, turning prefix mathematical
Where can I find some in-depth information on tuning statistics in SQL Server 2005?
I need help in turning this linq expression into a linq statment. SampleData.Publishers and
I'm currently developing a stored procedure for a complex search in a big database.
I am having some difficulty using a UIWebView to render PDF files on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.