# i have a vertica 7.0.1 table which captures stats on network traffic
# each record is the sum of bytes in all packets between 2 addresses over a time interval (say 10 seconds) which ends at time_t
# time_t is seconds since the epoch, 01-01-1970
CREATE TABLE network_stats(src_ip INT, dst_ip INT, time_t INT, bytes INT);
# ... watch the network traffic and fill the table for a while
# now find the sum of bytes over a period 5 minutes before through 5 minutes after each record for which the dst_ip is the same as the current record
SELECT a.time_t, a.src_ip, a.dst_ip,
(SELECT SUM(bytes) as tot FROM network_stats b WHERE time_t BETWEEN (a.time_t - 300) AND (a.time_t + 300) AND (b.dst_ip = a.dst_ip)) AS dst
FROM network_stats a;
ERROR 4160: Non-equality correlated subquery expression is not supported
OK, can this be done with an analytic query? The question is how to get criteria from the current row (the dst_ip) into the window range.
Thanks for help, marcus
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.