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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:44:44+00:00 2026-06-06T09:44:44+00:00

Let’s we have a lot of such classes(millions) class WordInfo { string Value; string

  • 0

Let’s we have a lot of such classes(millions)

class WordInfo
{
     string Value;
     string SomeOtherFeatures;
     List<Point> Points;
}

And following code

 private Dictionary<string, WordInfo> _dict;

   public void ProcessData(IEnumerable<Tuple<string,int,int> words)
   {
        foreach(var word in words)
        {
             if(_dict.ContainsKey(word.Item1))
             {
                 _dict[word.Item1].Points.Add(new Point(word.Item2,word.Item3));
             }
             else
             {
                 _dict.Add(word.Item1, new WordInfo(....))
             }
        } 
   }


   Main()
   {
       while(true)
       {
           IEnumerable<Tuple<string,int,int> data = GetDataSomewhere();
           ProcessData(data); 
       }
   }

As you can see this code must work 24\7. The main problem is that i donnt know how to represent _dict (place where i store information) in database. I need to process 1000-5000 words per second. Relational db is not good for my task, right? What about NoSQL? I need fast UPDATE and INSERT operations. Also i need fast check is word exists(SELECT) in db. Because of i have millions records it’s also not trivial. What do you can suggest? May be write my custom solution based on files?

  • 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-06-06T09:44:51+00:00Added an answer on June 6, 2026 at 9:44 am

    A relational database should be able to insert/update 1000-5000 words per second easily, assuming you don’t create too many transactions.

    Transactions are ACID and “D” means durable: when the client receives a notification that the transaction is committed, it is guaranteed that the effects of the transaction are already in the permanent storage (so even if a power cut happens at that exact moment, the transaction won’t be “erased”). In practice, this means the DBMS must wait for the disk to finish the physical write.

    If you wrap each and every insert/update in its own transaction, you’ll also have to perform this wait for each and every one of them. OTOH, if you wrap many inserts/updates in a single transaction, you’ll have to pay this price only once per whole “chunk”.


    Also, checking for the existence of a specific row within millions of others is a task databases are very good at, thanks to the power of B-Tree indexes.


    As for the database structure, you’d need something similar to this:

    enter image description here

    And you’d process it like this (pseudocode):

    BEGIN TRANSACTION;
    
    foreach(var word in words)
    {
         try {
             INSERT INTO WORD (WORD_VALUE, SOME_OTHER_FEATURES) VALUES (word.Item1, ...);
         }
         catch (PK violation) {
             // Ignore it.
         }
    
         try {
             INSERT INTO POINT (WORD_VALUE, X, Y) VALUES (word.Item1, word.Item2, word.Item3);
         }
         catch (PK violation) {
             // Ignore it.
         }
    } 
    
    COMMIT;
    

    (NOTE: I’m assuming you never update the SOME_OTHER_FEATURES after it has been initially inserted. If you do, the logic above would be more complicated.)

    If your DBMS supports it, consider making both of these tables clustered (aka. index-organized). Also, if your DBMS supports it, compress the leading edge of the POINT’s primary index (WORD_VALUE), since all points related to the same word contain same value there.


    BTW, the model above uses so-called identifying relationships and natural keys. An alternate model that uses surrogate keys and non-identifying relationships is possible, but would complicate the kind of processing you need.

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

Sidebar

Related Questions

Let's say I have the following classes : public class MyProductCode { private String
let's say I have a select list as follows: <select name='languages'> <option value='german'>German</option> <option
Let's say we have 3 classes: A, B and C. Each class has the
Let's suppose I have this piece of code. foreach(string value in myList) { string
Let's say I have an string variable called *magic_string* which value is set to
Let's say I have a base class 'A' and two classes 'B' and 'C',
Let's say you have a method that expects a numerical value as an argument.
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Let's say I have one class User, and it has a property of type

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.