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 1032511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:05:16+00:00 2026-05-16T14:05:16+00:00

I am reading records from database and check some conditions and store in List<Result>

  • 0

I am reading records from database and check some conditions and store in List<Result>. Result is a class. Then performing LINQ query in List<Result> like grouping, counting etc. So there may be chance that min 50,000 records in List<Result>, so in this whether its better to go for LINQ (or) reinsert the records to db and perform the queries?

  • 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-16T14:05:17+00:00Added an answer on May 16, 2026 at 2:05 pm

    Why not store it in an IQueryable instead of a List and using LINQ to SQL or LINQ to Entities, the actual dataset will never be pulled into memory, and the queries will actually go down to the database to run.

    Example:

    Database db = new Database(); // this is what L2E gives you...
    
    var children = db.Person.Where(p => p.Age < 21); // no actual database query performed
    
    
    // will do : "select count(*) from Person where Age < 21"
    int numChildren = children.Count();
    
    var grouped = children.GroupBy(p => p.Age); // no actual query
    
    int youngest = children.Min(p => p.Age); // performs query
    
    int numYoungest = youngest.Count(p => p.Age == youngest); // performs query.
    
    var youngestNames = children.Where(p => p.Age == youngest).Select(p => p.Name); // no query
    
    var anArray = youngestNames.ToArray(); // performs query
    
    string names = string.join(", ", anArray); // no query of course
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From my reading of some android forensic articles i understand that sqlite records can
First, let me explain the current situation: I'm reading records from a database and
Is reading the database records from the Database using Stored Procedures in NHibernate a
I am reading records from file and inserting into database. I am using DB2
i am reading records data from a file(records count can be up to thousands
I am reading a text file and processing some records, a relevant sample of
im trying to do delete records from multiple database tables. For error handling i'm
Team, I am doing a technical poc for reading records from a flat file
From a sql database, I am reading a table with 2 fields: appName, user.
I wrote a program which includes writing and reading from database. When I run

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.