1#187
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because a core requirement of the task—indexing all frequently used relational columns based on the usage scenarios—is not fully met yet, which affects [CHECKLIST ITEM #2] and [CHECKLIST ITEM #9]. You correctly created indexes on Customers(Email) and Products(Name) in task.sql, with names matching the column names, which aligns with the login and product search scenarios. However, there are no indexes on Orders(CustomerID) or on OrderItems(OrderID) / OrderItems(ProductID), even though these foreign keys will be heavily used for joins and lookups in an online shop that processes at least 100 new orders per day.
The critical fixes needed are:
- In
task.sql, add indexes onOrders(CustomerID)andOrderItems(OrderID)with index names matching the column names, for example:CREATE INDEX CustomerID ON Orders(CustomerID);andCREATE INDEX OrderID ON OrderItems(OrderID);. - Strongly consider (and in this task, effectively are expected to) add
CREATE INDEX ProductID ON OrderItems(ProductID);because product-based lookups in order items will also be frequent. - Optionally, update the initial comment in
task.sqlto reflect that this file is for index creation, not database creation; this is not a blocker, but will reduce confusion.
Once you add these missing indexes in task.sql, your solution will align with the checklist and the intended performance characteristics of the system. You’re very close—your existing index choices are good, you just need to complete the coverage for the orders-related tables.
✨ 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
| # Write your SQL code for the database creation here. Good luck! | ||
| USE ShopDB; | ||
| -- Логін: пошук клієнта по email | ||
| CREATE INDEX Email ON Customers(Email); |
There was a problem hiding this comment.
| CREATE INDEX Email ON Customers(Email); | ||
|
|
||
| -- Пошук товару по назві | ||
| CREATE INDEX Name ON Products(Name); No newline at end of file |
There was a problem hiding this comment.
Consider also creating indexes on Orders(CustomerID) and OrderItems(OrderID) (and possibly OrderItems(ProductID)), with index names matching the column names, to fully satisfy the “analyze usage scenarios and index needed columns” requirement.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it fully meets the functional and technical requirements of the task. Your task.sql correctly switches to ShopDB and creates all necessary indexes to support the described scenarios: login (Customers(Email)), product search (Products(Name)), and order-related lookups (Orders(CustomerID), OrderItems(OrderID), and OrderItems(ProductID)). All index names match their corresponding column names exactly, which satisfies the explicit naming constraint. The SQL syntax is valid for MySQL and should run cleanly as long as ShopDB and its tables are created beforehand by create-database.sql. There are no critical or blocking issues that would prevent the script from working as intended. Nicely done aligning the indexes with the real-world query patterns described in the task.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.