Created
November 7, 2013 18:00
-
-
Save tmuth/7359033 to your computer and use it in GitHub Desktop.
R > data.table() > bin top SQL from AWR repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bin SQL by elapsed per exec seconds | |
brks <- as.vector(c(0.1,0.25,0.5,0.75,1,1.5,5,10,60,600,3600,21600)) #establish bins for SQL | |
DT_SQL_BY_SNAPID[,bin:=findInterval(ELAP_P_EXEC, brks)] #create a new column with those bin index numbers | |
DT_SQL_BY_SNAPID[,bin2:=as.character(brks[1+findInterval(ELAP_P_EXEC, brks,all.inside=FALSE)])] #create another new column with the bin values | |
DT_SQL_BY_SNAPID[is.na(bin2),bin2:=paste0((brks[length(brks)]),"+")] #anything over the top bin will be NA, so change it to "top bin+" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment