-
Notifications
You must be signed in to change notification settings - Fork 13
Optimised stored procedure Pr_GetCallHistory #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…igrationsql_chngs
📝 WalkthroughWalkthroughA new database migration file introduces the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/resources/db/migration/dbiemr/V32__Assam_SP.sql
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (5)
src/main/resources/db/migration/dbiemr/V32__Assam_SP.sql (5)
1-1: LGTM!The
DROP PROCEDURE IF EXISTSstatement ensures idempotency for the migration, which is a best practice.
36-36: LGTM!Using
UNION ALLinstead ofUNIONis appropriate here since mother and child call records are distinct datasets with no possibility of duplicates between them. This avoids unnecessary deduplication overhead.
38-60: Verify indexes on child-related join columns.Similar to the mother records query, ensure indexes exist on:
t_mctsoutboundcalls.childIDt_childvaliddata.MCTSID_no_Child_IDThe INNER JOIN on Line 57-58 means child call records without matching entries in
t_childvaliddatawill be excluded. Verify this is the intended behavior.The script provided in the previous comment will also check for these child-related indexes.
62-64: LGTM!The procedure closing statements properly restore the delimiter, which is standard practice for MySQL stored procedure definitions.
12-34: Indexes already exist for all join columns in the base schema (V1__DB_IEMR.sql).This migration only creates a stored procedure and does not modify table structures. All columns referenced in the joins already have indexes from the initial schema:
t_bencall.OBCallID:FK_BenCall_MCTSOutboundCalls_idxt_mctsoutboundcalls.OBCallID: Primary keyt_mctsoutboundcalls.MotherID:FK_tMCTSOutboundCalls_MotherValidRecord_idxt_mctsoutboundcalls.ChildID:FK_tMCTSOutboundCalls_ChildValidData_idxt_mothervalidrecord.MCTSID_no: Unique keyt_childvaliddata.MCTSID_no_Child_ID: Unique keyThe WHERE clause change from
IFNULL(v_obcallid, t1.obcallid)to(v_obcallid IS NULL OR t1.obcallid = v_obcallid)is logically equivalent and should work efficiently with existing indexes.Likely an incorrect or invalid review comment.



📋 Description
JIRA ID: AMM-1660
Ticket was created to optimised the performance of the SP "Pr_GetCallHistory" in ASSAM server previously it was taking 31 sec now it will take 0.10 sec
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.