Skip to content

Use correlated subqueries on user_statistics table in the account_view for network stats - #13899

Open
sureshanaparti wants to merge 1 commit into
apache:4.22from
shapeblue:account_view-network-stats-improvements
Open

Use correlated subqueries on user_statistics table in the account_view for network stats#13899
sureshanaparti wants to merge 1 commit into
apache:4.22from
shapeblue:account_view-network-stats-improvements

Conversation

@sureshanaparti

@sureshanaparti sureshanaparti commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

This PR uses scalar correlated subqueries on user_statistics table in account_view for network stats (instead of lateral join, as in #12631 - this which was reverted here: #12965, due to incompatibility with MariaDB).
This works on both MySQL and MariaDB.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  • account_view updated with correlated subqueries.

SHOW CREATE VIEW account_view;

  • account_netstats_view shouldn't exist, this should fail.

SHOW CREATE VIEW account_netstats_view;

  • account_view queries execute in less time than before (query performance improved).

SELECT * FROM account_view WHERE id = 3;

  • EXPLAIN shows ref access on user_statistics (not index scan)

EXPLAIN ANALYZE SELECT * FROM account_view WHERE id = 3 \G

How did you try to break this feature and the system with this change?

@sureshanaparti sureshanaparti added this to the 4.22.2 milestone Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.71%. Comparing base (5dcb8ab) to head (1ad95b3).

Files with missing lines Patch % Lines
...ava/com/cloud/upgrade/dao/Upgrade42210to42220.java 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #13899   +/-   ##
=========================================
  Coverage     17.71%   17.71%           
- Complexity    15858    15860    +2     
=========================================
  Files          5926     5927    +1     
  Lines        533613   533621    +8     
  Branches      65285    65285           
=========================================
+ Hits          94517    94525    +8     
  Misses       428415   428415           
  Partials      10681    10681           
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.79% <62.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…w for network stats (instead of lateral join)
@sureshanaparti
sureshanaparti force-pushed the account_view-network-stats-improvements branch from f10583b to 1ad95b3 Compare August 17, 2026 19:36
@sureshanaparti

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

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.

2 participants