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

[analyse2] La requête est optimisée pour des inner join

parent 7b31b3e0
......@@ -59,7 +59,7 @@ FROM (
port_dst as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_src
......@@ -98,7 +98,7 @@ FROM (
port_src as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_dst
......@@ -165,7 +165,7 @@ FROM (
port_dst as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_src
......@@ -206,7 +206,7 @@ FROM (
port_src as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_dst
......@@ -275,7 +275,7 @@ FROM (
port_dst as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_src
......@@ -318,7 +318,7 @@ FROM (
port_src as port_ext
FROM
upload
LEFT JOIN
INNER JOIN
machines_sans_doublon
ON
machines_sans_doublon.mac_addr = upload.mac_dst
......@@ -427,14 +427,14 @@ GROUP BY
convert = lambda ip:ip
if not args.fichier or args.couleur:
styles = (None, None, None, None, None, down_color, up_color)
styles = (None, None, None, None, down_color, up_color)
else:
styles = None
entete = [u"Mac", u"Ip_crans", u"Ip_ext", u"Port_crans", u"Port_ext", unicode("Download (Mio)"), unicode("Upload (Mio)")]
longueur = [17, '*', '*', 10, 8, 14, 14]
format = ('s', 's', 's', 's', 's', 'o', 'o')
data = [[unicode(ligne['mac']), unicode(convert(ligne['ip_crans'])), unicode(convert(ligne['ip_ext'])), unicode(ligne['port_crans']), unicode(ligne['port_ext']), unicode(ligne["tot_download"]), unicode(ligne["tot_upload"])] for ligne in stats]
final_data = affichage.tableau(data, titre=entete, largeur=longueur, styles=styles, format=format, width=120)
entete = [u"Ip_crans", u"Ip_ext", u"Port_crans", u"Port_ext", unicode("Download (Mio)"), unicode("Upload (Mio)")]
longueur = [30, '*', 10, 8, 14, 14]
format = ('s', 's', 's', 's', 'o', 'o')
data = [[unicode(convert(ligne['ip_crans'])), unicode(convert(ligne['ip_ext'])), unicode(ligne['port_crans']), unicode(ligne['port_ext']), unicode(ligne["tot_download"]), unicode(ligne["tot_upload"])] for ligne in stats]
final_data = affichage.tableau(data, titre=entete, largeur=longueur, styles=styles, format=format, width=125)
output += u"Upload total : %s Mio, download total : %s Mio\n" % (sum([int(ligne["tot_upload"]) for ligne in stats])/1024/1024, sum([int(ligne["tot_download"]) for ligne in stats])/1024/1024)
output += final_data
......
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