SQL ordered by CPU Time-AWR

select t.snap_id as snap_id,
       to_char(t.startup_time, 'yyyy-mm-dd hh24:mi:ss') as "SQL第一次执行时间",
       to_char(t.begin_interval_time, 'yyyy-mm-dd hh24:mi:ss') as "快照开始时间",
       to_char(t.end_interval_time, 'yyyy-mm-dd hh24:mi:ss') as "快照结束时间"
  from DBA_HIST_SNAPSHOT t
 order by snap_id desc;
------------------------------------------------------------------------------------------------------------------
select *
  from (select round((t2.cpu_time_delta / 1000000), 2) as "cpu_time(s)",
               t2.executions_delta as "executions",
               round(((t2.cpu_time_delta / 1000000) / t2.executions_delta),
                     2) as "cpu per Exec (s)",
               round((t2.elapsed_time_delta / 1000000), 2) as "elapsed_time(s)",
               round((t2.cpu_time_delta / t2.elapsed_time_delta) * 100, 2) as "%CPU",
               --round(t1.user_io_wait_time / t2.elapsed_time_delta * 100, 2) as "%IO",
               t1.sql_id as sql_id,
               t1.module as "sql module",
               t1.sql_text as sql_text,
               t1.sql_fulltext as sql_fulltext,
               to_char(t3.begin_interval_time, 'yyyy-mm-dd hh24:mi:ss') as "begin time",
               to_char(t3.end_interval_time, 'yyyy-mm-dd hh24:mi:ss') as "end time"
          from v$sqlarea t1, DBA_HIST_SQLSTAT t2, DBA_HIST_SNAPSHOT t3
         where t1.sql_id = t2.sql_id
           and t2.snap_id = t3.snap_id
           and t2.executions_delta is not null
           and t2.executions_delta <> 0
           and t2.elapsed_time_delta is not null
           and t2.elapsed_time_delta <> 0
              -- and t1.parsing_schema_name in ('FASP_PLATFORM')
           and t2.snap_id = &snap_id
         order by t2.cpu_time_delta desc)
 where rownum <= 10;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29612373/viewspace-2102744/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29612373/viewspace-2102744/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
To estimate the ordered probit model using Maximum Likelihood Estimation (MLE), you can use the "VGAM" package in R. Here is an example code: ```R # Load the "VGAM" package library(VGAM) # Load the data (in this example, we use the "Prestige" dataset) data(Prestige) # Define the dependent and independent variables y <- Prestige$prestige x1 <- Prestige$education x2 <- Prestige$income # Define the log-likelihood function for the ordered probit model loglik <- function(theta, y, X) { mu <- X %*% theta p <- pnorm(c(-Inf, mu[-length(mu)], Inf)) lp <- diff(p) lp[y == length(p)] <- p[y == length(p)] ll <- sum(log(lp)) return(-ll) } # Estimate the ordered probit model using MLE op <- vglm(y ~ x1 + x2, family = cumulative(parallel = TRUE), weights = rep(1, length(y)), control = list(maxit = 1000, trace = TRUE), initdata = data.frame("estimate" = c(0, 0, 0)), coef = TRUE, method = "BFGS", crit = 1e-6, loglik = loglik, X = cbind(1, x1, x2)) # Print the summary of the model summary(op) ``` In this example, we define the log-likelihood function for the ordered probit model, which takes the parameter vector `theta`, the dependent variable `y`, and the independent variables `X` as input and returns the negative log-likelihood. We then use the `vglm` function to estimate the model using MLE. The `family` argument specifies the cumulative link function, and the `weights` argument specifies the weighting scheme. The `initdata` argument specifies the initial values for the optimization procedure. The `loglik` argument specifies the log-likelihood function, and the `X` argument specifies the design matrix. Finally, we print the summary of the model using the `summary` function. Note that the exact code may vary depending on the dataset and software package used. Also, it is important to note that MLE can be more computationally intensive than other methods for estimating the ordered probit model.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值