MongoDB query ranking

Overview: inquiry on the National College entrance examination scores of 7 million College students

details: a data table stores 7 million items of examinee score data. Candidates can query the total score and ranking by entering the admission card number. How can this requirement be optimally realized?

Datasheet fields: admission number, Chinese, math, English, synthesis, total score, name, student number

Apr.07,2021

I understand that the requirements are as follows:

  1. query only by admission number;
  2. admission card is unique;
  3. you need to return the total score and ranking for each return result.
  4. the frequency of grade change is not high, and the later the time is, the lower the frequency is.

implementation idea:

  • the admission card number sets up a unique index, so that the query is very fast, at the level of milliseconds.
  • write a separate service and calculate its ranking based on the total score of the record. This kind of query is the most efficient. Maintenance is more troublesome. Also consider the situation that the grades have changed and the rankings have not changed, which is not Synchronize.
  • or dynamically query the rankings every time, which is simple and efficient (for 700W data). There will be no questions of grades and rankings on Synchronize.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37e41-2c0af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37e41-2c0af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?