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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:41:23+00:00 2026-05-30T10:41:23+00:00

I am writing a little test app which connects to a SQL Server database

  • 0

I am writing a little test app which connects to a SQL Server database which has 2 tables in it. Table 1 is a list of data with a non unique key which points to multiple rows in table 2. At the moment what I do is traverse each record in Table 1 and then get the relevant records from Table 2 with a separate query. Table 2 has over 26 million records in it and this process takes a very long time. The data in Table 1 could have just a few hundred records in it or anything up to about 1 million.

Is there a way of speeding up this data access? Perhaps using a table join to get all the data in one query? Or anything else?

Sorry I cannot post the database tables or current code as I am under NDA as it is very sensitive data. The current code is sort of irrelevant here anyway as I am looking for a totally new (and better) way of doing this.

Please note I am using ADO within .NET with C#.

EDIT: I am okay doing the JOIN query but more asking if this will be more efficient with ADO? I know it would be more efficient in general but not sure if ADO can handle this. Also looking for some example C# code to do this. Thanks.

  • 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-30T10:41:25+00:00Added an answer on May 30, 2026 at 10:41 am

    You can get all the data in one go with a JOIN like this:

    SELECT t1.NonUniqueKey, t2.*
    FROM Table1 t1
        JOIN Table2 t2 ON t1.NonUniqueKey = t2.NonUniqueKey
    

    You’ll want to consider putting an index on NonUniqueKey, but this should be better for you than executing n queries, one per row in Table1

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

Sidebar

Related Questions

I am writing a silly little app in C++ to test one of my
I'm writing a little desktop app that should be able to encrypt a data
My little test-program is writing a serialized object into a mysql database, then retrieving
I'm writing a little debug app for a bit of kit we're developing and
I'm writing a little tile-based game, for which I'd like to support light sources.
This question might be a little specific but the test program im writing uses
I'm writing a little PE reader, so I run dumpbin alongside my test application
I am just writing a little test application to show a Gallery of images
I'm writing a little Symbian app and I'm having troubles with QDataWidgetMapper. This is
I am writing a test tool which places a large amount of load on

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.