The first time round, the mistakes were The second time round I turned to myaround scalability. I used a SQL new favourite in-memory data structure“ORDER BY RAND()” statement to server, redis, and its SRANDMEMBERreturn the next page to review. I knew command (a feature I requested a whilethis was an inefficient operation, but I ago with this exact kind of project inassumed that it wouldn’t matter since mind). The system maintains a redis setthe button would only be clicked of all IDs that needed to be reviewed foroccasionally. an assignment to be complete, and a separate set of IDs of all pages had beenSomething like 90% of our database reviewed. It then uses redis setload turned out to be caused by that one intersection (the SDIFFSTORESQL statement, and it only got worse as command) to create a set of unreviewedwe loaded more pages in to the system. pages for the current assignment andThis caused multiple site slow downs then SRANDMEMBER to pick one ofand crashes. those pages.
EXERCISE: DESIGN THE SSLC MARKS DATABASEEach student has an ID.There are totally 11 languages and 92 non-language subjects.Students usually write 3 language and 3 non-language exams.For example,• (English, Hindi, Sanskrit), (Maths, Physics, Chemistry)• (Kannada, Urdu, Marathi), (Commerce, Accountancy, Economics)You need to record their marks in all 6 subjects, and the total.
EXERCISE: DESIGN THE SSLC MARKS DATABASECommon queries: Some scenarios:Who scored the highest in Maths? Access from multiple locationsWhich subject had the highest fail %? Real-time marks updationHow many failed in 1 subject? Guarantee of correctness