|
39 | 39 | `data_center`.`id` AS `data_center_id`, |
40 | 40 | `data_center`.`uuid` AS `data_center_uuid`, |
41 | 41 | `data_center`.`name` AS `data_center_name`, |
42 | | - `account_netstats_view`.`bytesReceived` AS `bytesReceived`, |
43 | | - `account_netstats_view`.`bytesSent` AS `bytesSent`, |
| 42 | + `account_netstats`.`bytesReceived` AS `bytesReceived`, |
| 43 | + `account_netstats`.`bytesSent` AS `bytesSent`, |
44 | 44 | `vmlimit`.`max` AS `vmLimit`, |
45 | 45 | `vmcount`.`count` AS `vmTotal`, |
46 | 46 | `runningvm`.`vmcount` AS `runningVms`, |
|
89 | 89 | `cloud`.`domain` ON account.domain_id = domain.id |
90 | 90 | left join |
91 | 91 | `cloud`.`data_center` ON account.default_zone_id = data_center.id |
92 | | - left join |
93 | | - `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id |
| 92 | + left join lateral ( |
| 93 | + select |
| 94 | + coalesce(sum(`user_statistics`.`net_bytes_received` + `user_statistics`.`current_bytes_received`), 0) AS `bytesReceived`, |
| 95 | + coalesce(sum(`user_statistics`.`net_bytes_sent` + `user_statistics`.`current_bytes_sent`), 0) AS `bytesSent` |
| 96 | + from |
| 97 | + `cloud`.`user_statistics` |
| 98 | + where |
| 99 | + `user_statistics`.`account_id` = `account`.`id` |
| 100 | + ) AS `account_netstats` ON TRUE |
94 | 101 | left join |
95 | 102 | `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id |
96 | 103 | and vmlimit.type = 'user_vm' and vmlimit.tag IS NULL |
|
0 commit comments