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

  • Home
  • SEARCH
  • 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 923447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:11:42+00:00 2026-05-15T19:11:42+00:00

Assuming I have the following schema table A: ID int primary key value varchar(255)

  • 0

Assuming I have the following schema

table A:
ID int primary key
value varchar(255) not null

table B:
ID int primary key
AID foreign key refences A (ID)
name varchar(40) not null

now when I execute the following subsonic linq

var items = 
from a in A.All() 
where any-condition select a;

all is fine.

the killer is when I do the following

for(var item in items)
{
   for(var nestedItem in item.B) // troubling!
   {
     DoSomething(nestedItem)
   }
}

I am not very familiar with the inner workings, But I am pretty sure it does additional trips to the DB to get the joined table rows.

Can you please tell me how can I avoid such expensive trips?

  • 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-15T19:11:43+00:00Added an answer on May 15, 2026 at 7:11 pm

    This is a classic problem with ORMs – SELECT N + 1. What you’re coming up against is Lazy vs. Eager loading and in this case you need to either do some kind of outer join (using the query tool) or pull B into a list.

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

Sidebar

Related Questions

Assuming I have three tables : TableA (key, value) TableB (key, value) TableC (key,
I have some thread-related questions, assuming the following code. Please ignore the possible inefficiency
Assuming I have a class A as follows: class A{ int id; int getId(){};
It's my understanding that nulls are not indexable in DB2, so assuming we have
Assuming I have a schema that describes a root element class Root that contains
I have a schema fragment that looks like <xs:element name=dataValue> <xs:complexType> <xs:sequence> <xs:element name=value
Assuming you have a business that rents movie and you were designing a schema
I have the following Entity Framework POCO classes: public class Customer { public int
Hey there, assuming I have the following code in a mex routine: mxArray *newPoint
assuming that you have the following sentence in a requirements document The system has

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.