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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:16:08+00:00 2026-05-18T05:16:08+00:00

I have 200,000 records in a database with the PK as a varchar(50) Every

  • 0

I have 200,000 records in a database with the PK as a varchar(50)

Every 5 minutes I do a SELECT COUNT(*) FROM TABLE

If that result is greater than the List.Count I then execute

"SELECT * FROM TABLE WHERE PRIMARYKEY NOT IN ( " + myList.ToCSVString() + ")"

The reason I do this is because records are being added to the table via another process.

This query takes a long time to run and I also believe its throwing an OutOfMemoryException

Is there a better way to implement 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-18T05:16:09+00:00Added an answer on May 18, 2026 at 5:16 am

    SQL Server has a solution for this, add a timestamp column, every time you touch any row in the table the timestamp will grow.

    Add an index for the timestamp column.

    Instead of just storing ids in memory, store ids and last timestamp.

    To update:

    • select max timestamp
    • select all the rows between old max timestamp and current max timestamp
    • merge that into the list

    Handling deletions is a bit more tricky, but can be achieved if you tombstone as opposed to delete.

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

Sidebar

Related Questions

In a database I have less than 200,000 records in a table, and in
we have a database table which has around 200,000 records. which includes 3 ntext
i have a table with about 200,000 records. i want to add a field
I have 200,000 plus records in mysql database. When I run update query lets
I' m using sqlite on iphone. I have table with 200 000 records. It'
I have an Ajax call that updates 5,000 records in a database so this
I have a Customer table with 200.000+ records which i have to loop through
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a cfinvoke which writes to a table like 200,000 records. Then I
I have the video gallery in my database, which has over 200 000 videos.

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.