select count(*) from status_messages where cs_id=1;
-- select status messages in a given time range
-select count(*) from status_messages where cs_id=1;
-timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
+select count(*) from status_messages where timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
-- select status messages for a given swarm
select count(*) from status_messages S, client_sessions C where S.cs_id=C.id and C.swarm_id=1;
-- certain threshold
select count(*) from status_messages where upload_speed>100 and upload_speed<1000;
--- select peer status messages in a given client session
-select count(*) from peer_status_messages where cs_id=1;
-
--- select peer status messages in a given time range
-select count(*) from peer_status_messages where timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
-
--- select peer status messages for a given peer
-select count(*) from peer_status_messages where peer_ip='89.245.110.136' and peer_port=49887;
-
--- select peer status messages for a given swarm
-select count(*) from peer_status_messages P, client_sessions C where P.cs_id=C.id and C.swarm_id=1;
-
--- select peer status messages whose download speed is above a certain threshold
-select count(*) from peer_status_messages where download_speed>100 and download_speed<1000;
-
--- select peer status messages whose upload speed is above a certain threshold
-select count(*) from peer_status_messages where upload_speed>100 and upload_speed<1000;
+---- select all peers in peer status messages
+-- select distinct peer_ip,peer_port from peer_status_messages;
+--
+---- select all peers in peer status messages for a given client session
+-- select distinct peer_ip,peer_port from peer_status_messages where cs_id=1;
+--
+---- select peer status messages in a given client session
+-- select count(*) from peer_status_messages where cs_id=1;
+--
+---- select peer status messages in a given time range
+-- select count(*) from peer_status_messages where timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
+--
+---- select peer status messages for a given peer
+-- select count(*) from peer_status_messages where peer_ip='89.245.110.136' and peer_port=49887;
+--
+---- select peer status messages for a given swarm
+-- select count(*) from peer_status_messages P, client_sessions C where P.cs_id=C.id and C.swarm_id=1;
+--
+---- select peer status messages whose download speed is above a certain threshold
+-- select count(*) from peer_status_messages where download_speed>100 and download_speed<1000;
+--
+---- select peer status messages whose upload speed is above a certain threshold
+-- select count(*) from peer_status_messages where upload_speed>100 and upload_speed<1000;
-- select verbose messages for a given client session
select count(*) from verbose_messages where cs_id=1;
-- without an index, query takes around 2.0 seconds (on p2p-next-10)
select distinct peer_ip,peer_port from verbose_messages;
--- select all peers for a given client session
+-- select all peers in verbose messages for a given client session
select distinct peer_ip,peer_port from verbose_messages where cs_id=1;
--- select all peers for a given swarm
+-- select all peers in verbose messages for a given swarm
select distinct peer_ip,peer_port from verbose_messages V, client_sessions C where V.cs_id=C.id and swarm_id=1;
-- select number of verbose messages exchanged with each peer
select count(*) from verbose_messages where cs_id=1 and direction=1;
-- select verbose messages in a given time range for a given client session
-select count(*) from verbose_messages where cs_id=1 and message_type=2;
-timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
+select count(*) from verbose_messages where cs_id=1 and timestamp<'2009-07-01 00:00:00' and timestamp>'2009-06-10 00:00:00';
-- select verbose messages for a given peer in a client session
select count(*) from verbose_messages where cs_id=1 and peer_ip='89.245.110.136' and peer_port=49887;
select count(*) from verbose_messages where direction=1 and peer_ip='89.245.110.136' and peer_port=49887;
-- select verbose messages of a given type in a swarm
-select count(*) from verbose_messages V, client_session C where C.id=V.cs_id and message_type=2 and swarm_id=1;
+select count(*) from verbose_messages V, client_sessions C where C.id=V.cs_id and message_type=2 and swarm_id=1;
-- select verbose messages of a given swarm in a given direction
-select count(*) from verbose_messages V, client_session C where C.id=V.cs_id and direction=1 and swarm_id=1;
+select count(*) from verbose_messages V, client_sessions C where C.id=V.cs_id and direction=1 and swarm_id=1;
-- select verbose messages of a given type in a given direction for a given
-- client session
-- select verbose messages of a given type in a given direction for a given
-- swarm
-select count(*) from verbose_messages V, client_session C where C.id=V.cs_id and direction=1 and message_type=2 and swarm_id=1;
+select count(*) from verbose_messages V, client_sessions C where C.id=V.cs_id and direction=1 and message_type=2 and swarm_id=1;
-- select verbose messages of a given type for a given peer in a client session
select count(*) from verbose_messages where cs_id=1 and peer_ip='89.245.110.136' and peer_port=49887 and message_type=2;