Hi,
We are pulling in data from a number of db's, via db connect. The data spans many different tables, requiring us to do a number of joins. The response hasn't been acceptable, and we are looking at other options, including creating views within the db's. Our query is below - is there anything obvious that can be improved?
index="perfstats" source="dbmon-tail://TQ/CPUBYVIRTCPU" System=*$Host$*
| eval Actual_Interval_A = Actual_Interval
| eval Virtual_Machine_A=Virtual_Machine
| JOIN type=left System [SEARCH index="perfstats" source="dbmon-tail://TQ/CPUVMSUM" System=*$Host$*]
| JOIN type=left System [SEARCH index="perfstats" source="dbmon-tail://TQ/VMVMS" System=*$Host$*]
| JOIN type=left System [SEARCH index="perfstats" source="dbmon-tail://TQ/MEMBYVM" System=*$Host$*]
| JOIN type=left System [ SEARCH index="perfstats" source="*BLKDEVBYVM" System=*$Host$*
| eval Actual_Interval_B=Actual_Interval ]
| JOIN type=left System [SEARCH index="perfstats" source="dbmon-tail://TQ/HINVSUM" earliest=-1d System=*$Host$*| eval System=System]
| rename System as host
| JOIN type=left host [SEARCH index="perfstats" source="*VMHOSTCONF" earliest=-7d Cluster!=P* Cluster!=N*
| eval host=lower(Host)]
| stats sum(reads) AS "io_reads" , sum(writes) AS "io_writes",sum(eval(KB_read_s/Actual_Interval_B)) as "kb_reads", sum(eval(KB_write_s/Actual_Interval_B)) as "kb_writes",avg(avgReadLatency) AS "diskresp_reads", avg(avgWriteLatency) AS "diskresp_writes",avg(avgQueueReadLatency) AS "diskqueue_reads", avg(avgQueueWriteLatency) AS "diskqueue_writes", sum(Actual_Interval_B ) as "interval" distinct_count(Virtual_Machine_A) AS "#VMs" sum(ready) as "r" sum(Actual_Interval_A) as "t" sparkline(sum(eval(ready/Actual_Interval))) as "CPU Trend" avg(VCPU_Count) as "vcpu" avg(online_cpus) as "c" avg(online_cpus_physical) as "cp" avg(busy) as "busy" avg(consumed) AS "memCons", avg(size) AS "memGran", avg(totalCapacity) AS "memInst" by Cluster,host
| eval "CPU Ready/Wait"=round((r/t)*100,2)
| eval "# of Cores"=ceil((c+cp))
| eval "#VCPUs"=ceil(vcpu)
| eval "% busy"=round(busy,2)
| eval "Memory Consumed (GB)"=round(memCons/1024,2)
| eval "Memory Granted (GB)"=round(memGran/1024,2)
| eval "Memory Installed (GB)"=round(memInst/1024,2)
| eval "Response Time Reads"=round(diskresp_reads,2)
| eval "Response Time Writes"=round(diskresp_writes,2)
| eval "Queue Reads"=round(diskqueue_reads,2)
| eval "Queue Writes"=round(diskqueue_writes,2)
| eval "IO Reads"= round((io_reads/interval),2)
| eval "IO Writes"=round((io_writes/interval),2)
| eval "IO Total" = ($IO Reads$)+($IO Writes$)
| eval "Throughput Reads (MBs/second)"=round((kb_reads/(interval*1024)),4)
| eval "Throughput Writes (MBs/second)"=round((kb_writes/(interval*1024)),4)
| eval "Throughput Total (MBs/second)" = ($Throughput Reads (MBs/second)$)+($Throughput Writes (MBs/second)$)
| eval "Response Time Total"= ($Response Time Reads$)+($Response Time Writes$)
| eval "Queue Total"= ($Queue Reads$)+($Queue Writes$)
| table host,"CPU Ready/Wait","CPU Trend", "#VCPUs","VMotions","# of Cores", "% busy", "Memory Consumed (GB)", "Memory Granted (GB)", "Memory Installed (GB)", "#VMs" "IO Reads" "IO Writes" "IO Total" "Throughput Reads (MBs/second)" "Throughput Writes (MBs/second)" "Throughput Total (MBs/second)" "Response Time Reads" "Response Time Writes" "Response Time Total" "Queue Reads" "Queue Writes" "Queue Total"
| sort - "CPU Ready/Wait"