Hi,
Is there any performance impact on below query? delay running this query is evident. Delay noticed when analytic function added in the main query.
select
ifmet.netif_qname,
ifmet.netif_name,
ifmet.netif_alias,
ifmet.pw,
ifmet.netif_speed_in_out_bit_per_s,
ifmet.node_name,
ifmet.timestamp1 as timestamp,
(case when (round(max(ifmet.MaxInBpsRef),2) >= round(max(ifmet.MaxOutBpsRef),2)) then
(case when (round(max(ifmet.MaxInBpsRef),2) < 1000) then 'bps'
when (round(max(ifmet.MaxInBpsRef),2) < 1000000) then 'Kbps'
when (round(max(ifmet.MaxInBpsRef),2) < 1000000000) then 'Mbps'
else 'Gbps' end)
else (case when (round(max(ifmet.MaxOutBpsRef),2) < 1000) then 'bps'
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000) then 'Kbps'
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000000) then 'Mbps'
else 'Gbps' end)
end) as Label,
(case when (round(max(ifmet.MaxInBpsRef),2) >= round(max(ifmet.MaxOutBpsRef),2)) then
(case when (round(max(ifmet.MaxInBpsRef),2) < 1000) then round(avg(ifmet.Inbps),2)
when (round(max(ifmet.MaxInBpsRef),2) < 1000000) then (round(avg(ifmet.Inbps),2)/1000)
when (round(max(ifmet.MaxInBpsRef),2) < 1000000000) then (round(avg(ifmet.Inbps),2)/1000000)
else (round(avg(ifmet.Inbps),2)/1000000000) end)
else (case when (round(max(ifmet.MaxOutBpsRef),2) < 1000) then round(avg(ifmet.Inbps),2)
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000) then (round(avg(ifmet.Inbps),2)/1000)
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000000) then (round(avg(ifmet.Inbps),2)/1000000)
else (round(avg(ifmet.Inbps),2)/1000000000) end)
end) as avgInbps,
(case when (round(max(ifmet.MaxInBpsRef),2) >= round(max(ifmet.MaxOutBpsRef),2)) then
(case when (round(max(ifmet.MaxInBpsRef),2) < 1000) then round(avg(ifmet.Outbps),2)
when (round(max(ifmet.MaxInBpsRef),2) < 1000000) then (round(avg(ifmet.Outbps),2)/1000)
when (round(max(ifmet.MaxInBpsRef),2) < 1000000000) then (round(avg(ifmet.Outbps),2)/1000000)
else (round(avg(ifmet.Outbps),2)/1000000000) end)
else (case when (round(max(ifmet.MaxOutBpsRef),2) < 1000) then round(avg(ifmet.Outbps),2)
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000) then (round(avg(ifmet.Outbps),2)/1000)
when (round(max(ifmet.MaxOutBpsRef),2) < 1000000000) then (round(avg(ifmet.Outbps),2)/1000000)
else (round(avg(ifmet.MaxOutBpsRef),2)/1000000000) end)
end) as avgOutbps
from (
select distinct
a.netif_qname,
a.netif_name,
a.netif_alias,
split_part(a.netif_alias,':',3) as pw,
a.netif_type,
a.netif_physical_add,
a.netif_speed_in_out_bit_per_s,
a.node_name,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then (max(b.throughput_in_bit_per_s) over ()) else (max(c.throughput_in_max_bit_per_s) over ()) end MaxInBpsRef,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then (max(b.throughput_out_bit_per_s) over ()) else (max(c.throughput_out_max_bit_per_s) over ()) end MaxOutBpsRef,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then to_timestamp(b.timestamp_utc_s) else to_timestamp(c.timestamp_utc_s) end timestamp1,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then b.throughput_in_bit_per_s else c.throughput_in_avg_bit_per_s end Inbps,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then b.throughput_out_bit_per_s else c.throughput_out_avg_bit_per_s end Outbps,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then b.throughput_in_bit_per_s else c.throughput_in_max_bit_per_s end Inbpsmax,
case when ((datediff(day,'2023-05-22 00:00',now())) < 7) then b.throughput_out_bit_per_s else c.throughput_out_max_bit_per_s end Outbpsmax
from mf_shared_provider_default.nom_interface_health b
inner join mf_shared_provider_default.nom_interface_health_1h c
on b.netif_unique_id = c.netif_unique_id
left join mf_shared_provider_default.nom_entity_interface_raw a
on a.netif_unique_id = b.netif_unique_id
where a.netif_unique_id in ('1cd80d2e-4893-4198-aaca-3c4f602245df')
and ((b.throughput_out_bit_per_s is not null)
and (c.throughput_out_avg_bit_per_s is not null))
and ((to_timestamp(b.timestamp_utc_s) >= '2023-05-22 00:00') and (to_timestamp(b.timestamp_utc_s) < '2023-05-28 23:59'))
and ((to_timestamp(c.timestamp_utc_s) >= '2023-05-22 00:00') and (to_timestamp(c.timestamp_utc_s) < '2023-05-28 23:59'))) ifmet
group by ifmet.netif_qname,ifmet.netif_name,ifmet.netif_alias,ifmet.pw,ifmet.netif_speed_in_out_bit_per_s,ifmet.node_name,ifmet.timestamp1
order by ifmet.timestamp1