Skip to content

refactor(kpi,PIN-6997): performance optimization of IPs-by-client-view#167

Draft
marco-vit-pagopa wants to merge 3 commits intomainfrom
chore/PIN-6997_performance_optimization_on_ips_view
Draft

refactor(kpi,PIN-6997): performance optimization of IPs-by-client-view#167
marco-vit-pagopa wants to merge 3 commits intomainfrom
chore/PIN-6997_performance_optimization_on_ips_view

Conversation

@marco-vit-pagopa
Copy link
Contributor

@marco-vit-pagopa marco-vit-pagopa commented Feb 13, 2026

Pull request overview

This PR implements a performance optimization for the IPs-by-client-view (PIN-6997) by consolidating materialized views and adjusting time window parameters for auth server usage tracking.

Changes:

  • Consolidated three separate IP tracking views (main, latest_ts, oldest_ts) into a single view with computed aggregations
  • Refactored client-tenant join to use the standard direct consumer_id relationship instead of indirect path through purpose tables
  • Adjusted auth usage time windows from 5/15/30 minutes to 15/30/45 minutes and added last_minute_with_requests tracking

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a performance optimization for the IPs-by-client-view (PIN-6997) by consolidating materialized views and adjusting time window parameters for auth server usage tracking.

Changes:

  • Consolidated three separate IP tracking views (main, latest_ts, oldest_ts) into a single view with computed aggregations
  • Refactored client-tenant join to use the standard direct consumer_id relationship instead of indirect path through purpose tables
  • Adjusted auth usage time windows from 5/15/30 minutes to 15/30/45 minutes and added last_minute_with_requests tracking

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
R__application_mv_01_auth_usage__data__last_calls.sql Updated time periods to 15/30/45 minutes and added last_minute_with_requests field
R__application_mv_01_client_tenant_authserver_ips.sql Simplified to use standard client->tenant join and reference consolidated timestamps from main view
R__application_mv_00_client_tenant_authserver_ips__oldest_ts.sql Removed as functionality consolidated into main view
R__application_mv_00_client_tenant_authserver_ips__main.sql Enhanced to compute both latest_ts and oldest_ts using MAX/MIN aggregations, simplified join path
R__application_mv_00_client_tenant_authserver_ips__latest_ts.sql Removed as functionality consolidated into main view

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…usage__data__last_calls.sql

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant