# Mudit Jha | 3 years exp - Ok with DB design, Have to change the columns when asked to write the query. - Able to write a wrapper function for continusous calling a function, but couldnt resolve [heap out of memory] issue. - Not good for SDE 2. Can consider for SDE 1 role. # Question 1: Facebook Posts. - post, likes, comments(infinite level), share SELECT * FROM POSTS WHERE USERID = `USERID`; #For each post that we fetch for a user SELECT * FROM COMMENTS WHERE POSTID = `postId` where ParentCommendId = NULL; Post.ID = Comment.PostID SELECT Post.ID, Post.Content, Post.Likes, Post.Comments, Comment.CommentContennt, Comment.User, Comment.Date, Comments.Likes, Like.PostID, Like.CommentID, Like.UserID ON Post.ID = Comment.PostID AND Comment.ID = Like.CommentID FROM Post, Comment, Like WHERE Post.UserId = `UserId` AND Comment.ParentCommentId = NULL; Post - ID - Content - User - LikesCount - CommentsCount - Likes - Comments - Media - Shares Comment - PostID - CommentID - ParentCommentID - CommentContent - User - Date - Likes Like - ID - PostID - CommentID - UserID #who liked the post Share - ID - PostID - UserID #user who has made the shared post Media - ID - S3 URL - Share : An action to create a new Post instance User - ID - Other details #Wrapper function to keep calling the SQS client and return data if present class SDKClient: def get_latest_message_from_queue(client: SQSClient): #Make internal call to SDK while True: count = sdk_client.get_queue_length() if count > 0: #We want to fetch messages message = sdk_client.get_latest_message() #Do processing based on some field else: break