Optimizing Database Queries for Improved Company Requirement Tracking

The State Changers met to address a problem with how user data was being processed. The existing method was slow due to nested for loops and involved tracking user compliance based on requirements set by companies. They aimed for a solution that would efficiently produce a record of users who did not meet certain criteria.


A participant was looking for a more proficient way to calculate whether specific user requirements were met or incomplete, considering this was done by looping through all the user requirements and company requirements, individually looking at the status of each, and comparing them, which was slow and ineffective. The State Changers proposed using page queries for processing and fetching the required information. The participant was advised to set up a database request that would return user requirements based on a list of required user IDs associated with each company requirement. The solution was to make a 'Join' on the 'User' and 'User Requirement' tables based on the 'User ID' and to additionally filter the User requirements to only consider non-archived records. This was then linked with the company requirement IDs. The participants also discussed using 'Eval' fields and creating a custom output field to include data from the 'User Requirement' table. They highlighted that the join operation could make data retrieval more complex but was also a more powerful way to use the relational database for better performance results. The adopted solution meant iterating once over the database, removing the need for nested loops and improving the efficiency and speed of the data retrieval process. Due to the complexity, they advised trying it out in a less complicated setting before fully operationalizing it in the more complex environment. The conclusion was that if a record was empty it would mark the user as 'incomplete'. The team concurred it was a workable solution to proceed with. Keywords mentioned: Database, User Requirements, Company Requirements, Query, Join Operation, Eval Fields, User ID, Performance.


(Source: Office Hours 9/8/2023 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free