Commit aa63141c authored by Pierre-Elliott Bécue's avatar Pierre-Elliott Bécue

[comptage] "Optimisations"

parent 6ca9a058
......@@ -56,8 +56,6 @@ FROM (
machines.mac_addr = upload.mac_src
WHERE
ip_src=%(pg_value)s
AND NOT
ip_src <<= inet%(ipv6_local)s
AND NOT
ip_dst <<= inet%(ipv6_local)s
AND NOT
......@@ -69,7 +67,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......@@ -97,8 +95,6 @@ FROM (
ip_dst=%(pg_value)s
AND NOT
ip_src <<= inet%(ipv6_local)s
AND NOT
ip_dst <<= inet%(ipv6_local)s
AND NOT
ip_src <<= inet%(plage_ens)s
AND NOT
......@@ -108,7 +104,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......@@ -152,7 +148,7 @@ FROM (
ON
machines.mac_addr = upload.mac_src
WHERE
machines.mac_addr=%(pg_value)s
mac_src=macaddr%(pg_value)s
AND NOT
ip_src <<= inet%(ipv6_local)s
AND NOT
......@@ -166,7 +162,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......@@ -191,7 +187,7 @@ FROM (
ON
machines.mac_addr = upload.mac_dst
WHERE
machines.mac_addr=%(pg_value)s
mac_dst=macaddr%(pg_value)s
AND NOT
ip_src <<= inet%(ipv6_local)s
AND NOT
......@@ -205,7 +201,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......@@ -265,7 +261,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......@@ -306,7 +302,7 @@ FROM (
AND
stamp_inserted >= %(begin)s
AND
stamp_updated <= %(end)s
stamp_inserted <= %(end)s
GROUP BY
mac,
ip_crans,
......
......@@ -108,9 +108,9 @@ FROM (
FROM
upload
WHERE
stamp_updated > now() - interval '1 day'
AND stamp_updated < now()
AND NOT (ip_dst <<= inet%(plage_ens)s OR ip_dst <<= inet%(plage_ipv6)s OR ip_dst <<= inet%(appt)s OR ip_src <<= inet%(ipv6_local)s OR ip_src='0.0.0.0')
stamp_inserted > now() - interval '1 day'
AND stamp_inserted < now()
AND NOT (ip_dst <<= inet%(plage_ens)s OR ip_dst <<= inet%(plage_ipv6)s OR ip_dst <<= inet%(appt)s OR ip_src <<= inet%(ipv6_local)s OR ip_src=inet'0.0.0.0' OR ip_src <<= inet%(plage_adm)s OR ip_dst <<= inet%(plage_adm)s)
AND (ip_src <<= inet%(allone)s OR ip_src <<= inet%(alltwo)s OR ip_src <<= inet%(plage_ipv6)s OR ip_src <<= inet%(appt)s)
AND NOT EXISTS
(
......@@ -138,7 +138,7 @@ GROUP BY
ORDER BY
tot_upload;
"""
curseur.execute(requete, {'plage_ens':plage_ens, 'allone':NETs['all'][0], 'alltwo':NETs['all'][1], 'plage_ipv6':prefix['subnet'][0], 'appt':NETs['personnel-ens'][0], 'ipv6_local':'fe80::/8'})
curseur.execute(requete, {'plage_ens':plage_ens, 'allone':NETs['all'][0], 'alltwo':NETs['all'][1], 'plage_ipv6':prefix['subnet'][0], 'appt':NETs['personnel-ens'][0], 'ipv6_local':'fe80::/8', 'plage_adm':NETs['adm'][0]})
uploadeurs = curseur.fetchall()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment