feat: add indexes for Customers.Email and Products.Name#198
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because the current solution does not fully implement the required indexing based on the described usage scenario, which is a core part of the task. You correctly added indexes on Customers.Email and Products.Name, which matches the login and product search patterns. However, the task explicitly expects you to analyze frequent order creation and lookups, and Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID are clearly used in joins and lookups; leaving these without indexes means the requirement to index all relevant tables/columns is not met [CHECKLIST ITEM #2].
To fix this, add indexes on those three columns with index names matching the column names, for example:
CREATE INDEX CustomerID ON Orders (CustomerID);CREATE INDEX OrderID ON OrderItems (OrderID);CREATE INDEX ProductID ON OrderItems (ProductID);
Make sure these statements are intask.sqlafterUSE ShopDB;and then run the script againstShopDBto confirm it executes without errors before runningtest.sql. As a minor improvement (not a blocker), update the file comment at the top oftask.sqlso it mentions index creation rather than database creation, to better reflect its purpose. Once you add the missing indexes and verify the script runs cleanly, your solution will align well with the task requirements.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| USE ShopDB; | ||
|
|
||
| CREATE INDEX Email ON Customers (Email); | ||
| CREATE INDEX Name ON Products (Name); |
There was a problem hiding this comment.
The task description requires you to analyze the usage scenario and index all relevant tables/columns. Beyond Email and Name, Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID are likely to be heavily used in joins and lookups and should have indexes created here as well, with names matching the column names.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it meets all core functional requirements for the task. You correctly set the database context with USE ShopDB; at the top of task.sql, and you created indexes on all the key lookup/join columns: Customers.Email, Products.Name, Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID, with index names matching their respective column names as required. These indexes align with the described usage patterns (login by email, product search by name, and order/order-item lookups by IDs) and should work correctly against the ShopDB MySQL schema.
There are no critical or blocking issues remaining; the script should execute successfully and fulfill the task’s expectations. The only minor improvement to consider is updating the top comment in task.sql so it clearly states that the script creates indexes rather than the database, which will make the file’s purpose more obvious to future readers. Overall, you’ve implemented the indexing logic well and followed the naming and placement conventions accurately—nice work.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| USE ShopDB; | ||
| USE ShopDB; | ||
|
|
||
| CREATE INDEX Email ON Customers (Email); |
There was a problem hiding this comment.
This script correctly sets the database context and then creates all required indexes with names matching their columns. The only small improvement you might consider is updating the top comment to say this file creates indexes (not the database), so its purpose matches the task description more clearly.
No description provided.