Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sql/reports/topgear/payments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ SELECT
p.total_amount,
p.payment_status,
p.billing_account,
p.created_at
p.created_at,
w.winner_id as user_id
FROM finance.payment p
INNER JOIN finance.winnings w on p.winnings_id = w.winning_id
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The join condition uses p.winnings_id = w.winning_id. Ensure that both winnings_id and winning_id are indexed to optimize the join performance, especially if these tables are large.

WHERE p.created_at >= $1::timestamptz
AND p.created_at <= $2::timestamptz
ORDER BY p.created_at DESC;
AND p.billing_account = '80000062'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The hardcoded billing account value '80000062' could lead to maintainability issues if this value needs to change in the future. Consider parameterizing this value to improve flexibility and maintainability.

ORDER BY p.created_at DESC;
Loading