| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| -- Average CPU and DB usage by Domain |
| SELECT DOMAIN, AVG(CORE) Average_CPU_Usage, AVG(DB) Average_DB_Usage |
| FROM WEB_STAT |
| GROUP BY DOMAIN |
| ORDER BY DOMAIN DESC; |
| |
| -- Sum, Min and Max CPU usage by Salesforce grouped by day |
| SELECT TRUNC(DATE,'DAY') DAY, SUM(CORE) TOTAL_CPU_Usage, MIN(CORE) MIN_CPU_Usage, MAX(CORE) MAX_CPU_Usage |
| FROM WEB_STAT |
| WHERE DOMAIN LIKE 'Salesforce%' |
| GROUP BY TRUNC(DATE,'DAY'); |
| |
| -- list host and total active users when core CPU usage is 10X greater than DB usage |
| SELECT HOST, SUM(ACTIVE_VISITOR) TOTAL_ACTIVE_VISITORS |
| FROM WEB_STAT |
| WHERE DB > (CORE * 10) |
| GROUP BY HOST; |