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

The Archive Base Latest Questions

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

I am having a large data set (number based data, for example, 200,000 rows

  • 0

I am having a large data set (number based data, for example, 200,000 rows of numbers) in django database, and the client will pass in another set of data, for example 100-500 pieces of number based data, then the server needs to find out what numbers are already in the database from the data passed in. Let’s say the number data are phone numbers. If I just do the regular number comparison, the server cant even handle 2-3 requests from clients.

Please suggest me some solution for my problem.

  • 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-29T04:29:18+00:00Added an answer on May 29, 2026 at 4:29 am

    Are the numbers unique? Are they keyed?

    SELECT num FROM table WHERE num IN (111,222,333,....500 numbers later..., 99999)
    

    Should give you a list of numbers that are in the db, you take that list, compare it against your set and take the difference.

    Most SQL DBs will take a SQL statement that size, it’s actually quite performant, and, if you’re only interested in actual existence, then the DB will likely simply scan the index and never hit the actual rows (depends on the DB of course).

    So, try that and see how it works. If your numbers aren’t indexed, then you’re doomed at the gate — fix that too.

    Addenda:

    Simply, if your number is unique, you need to ensure that you have an index on that number’s columns in your database. If you want to enforce that it remains unique, you can make it a unique index, but that’s now required:

    CREATE UNIQUE INDEX i1 ON table(num)
    

    If you don’t have the index, the db will continually scan all of the rows of the table, which is not what you want.

    And, yes, the 111,222,333 are the numbers passed from the clients that you’re checking for.

    Lets say that you had the numbers 1,2,3,4,5,6 in your database, and the list of the client is 1,5,7. When you execute the SELECT num FROM table WHERE num IN (1,5,7) you will get back 2 rows: 1 and 5.

    So, you’ll need to compare the result number, 1,5 to you list, 1,5,7. I don’t know enough Python, much less Django, to give you a good example, but a quick glance shows that they have ‘set’ objects. With these you could do:

    newSet = clientSet.difference(dbSet)
    

    where clientSet is the set of numbers from the client, dbSet is the set of numbers from the query given, and newSet is the list of numbers that the client has that are not in the db.

    I may be misusing the set operator ‘difference’, but that’s the gist of it.

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

Sidebar

Related Questions

I am having issues figuring out how to sort a large data set into
I have a reasonably large set of strings (say 100) which has a number
I am using the nested set model to store a large hierarchy of data
I've got a very large xml data set that is structured like the following:
Quite a few apps support plugins. Are there any downsides to having a large
Having no end of trouble including a large landscape pdf in a portrait .tex
I am having some threading issues with a large app I am working on
I am having an issue with importing a large(60MB) CSV file in MYSQL DB.
We're having an issue on one of our fairly large websites with spam bots.
Here is the issue I am having: I have a large query that needs

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.