Compare commits
16 Commits
6c78331d26
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0eb8ecf506 | |||
| c434145fa1 | |||
| 099266cd64 | |||
| ad1287d947 | |||
| fe694579f1 | |||
| 7dbc3aefde | |||
| 612612b37a | |||
| f5b352c036 | |||
| 362ef3489b | |||
| b9829f374a | |||
| 3e209b2243 | |||
| 5e6a0e9b2f | |||
| d09b506b03 | |||
| ddce9ae3ba | |||
| 8603108d2c | |||
| 1fa5b8b496 |
@@ -1,16 +1,20 @@
|
|||||||
-- 获取最新的数据
|
-- 获取最旧于最新的数据
|
||||||
select to_timestamp(max(timestamp))
|
select to_timestamp(min(timestamp)) as min, to_timestamp(max(timestamp)) as max
|
||||||
from activities;
|
from activities;
|
||||||
|
|
||||||
-- 获取最旧的数据
|
-- 最大与最小id
|
||||||
select to_timestamp(min(timestamp))
|
select min(activity_id), max(activity_id)
|
||||||
|
from activities;
|
||||||
|
|
||||||
|
-- 数据总量
|
||||||
|
select max(activity_id) - min(activity_id) + 1
|
||||||
from activities;
|
from activities;
|
||||||
|
|
||||||
-- 1天内的数据,按action分组排序
|
-- 1天内的数据,按action分组排序
|
||||||
select b.action_id, b.action, count(b.action_id)
|
select b.action_id, b.action, count(b.action_id)
|
||||||
from activities as a
|
from activities as a
|
||||||
left join actions as b on a.action_id = b.action_id
|
left join actions as b on a.action_id = b.action_id
|
||||||
where timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
where timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by b.action_id, b.action
|
group by b.action_id, b.action
|
||||||
order by count(b.action_id) desc;
|
order by count(b.action_id) desc;
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ select cause_player_id, players.player, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join players on activities.cause_player_id = players.player_id
|
left join players on activities.cause_player_id = players.player_id
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by cause_player_id, player
|
group by cause_player_id, player
|
||||||
order by count(cause_player_id) desc;
|
order by count(cause_player_id) desc;
|
||||||
|
|
||||||
@@ -27,7 +31,7 @@ order by count(cause_player_id) desc;
|
|||||||
select *
|
select *
|
||||||
from activities
|
from activities
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and cause_id is not null
|
and cause_id is not null
|
||||||
limit 500;
|
limit 500;
|
||||||
|
|
||||||
@@ -36,7 +40,7 @@ select cause_entity_type_id, entity_type, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join entity_types on activities.cause_entity_type_id = entity_types.entity_type_id
|
left join entity_types on activities.cause_entity_type_id = entity_types.entity_type_id
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and cause_player_id is null
|
and cause_player_id is null
|
||||||
group by cause_entity_type_id, entity_type
|
group by cause_entity_type_id, entity_type
|
||||||
order by count(cause_entity_type_id) desc;
|
order by count(cause_entity_type_id) desc;
|
||||||
@@ -46,7 +50,7 @@ select activities.cause_id, causes.cause, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join causes on activities.cause_id = causes.cause_id
|
left join causes on activities.cause_id = causes.cause_id
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and activities.cause_id is not null
|
and activities.cause_id is not null
|
||||||
group by activities.cause_id, causes.cause
|
group by activities.cause_id, causes.cause
|
||||||
order by count(activities.cause_id) desc;
|
order by count(activities.cause_id) desc;
|
||||||
@@ -56,7 +60,7 @@ select world_id, x, y, z, count((world_id, x, y, z))
|
|||||||
from activities
|
from activities
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and cause_id = (select cause_id from causes where cause = 'nature')
|
and cause_id = (select cause_id from causes where cause = 'nature')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by world_id, x, y, z
|
group by world_id, x, y, z
|
||||||
order by count((world_id, x, y, z)) desc;
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ select world_id, x, y, z, count((world_id, x, y, z))
|
|||||||
from activities
|
from activities
|
||||||
where action_id = (select action_id from actions where action = 'block-place')
|
where action_id = (select action_id from actions where action = 'block-place')
|
||||||
and cause_id = (select cause_id from causes where cause = 'unknown')
|
and cause_id = (select cause_id from causes where cause = 'unknown')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by world_id, x, y, z
|
group by world_id, x, y, z
|
||||||
order by count((world_id, x, y, z)) desc;
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
@@ -74,7 +78,7 @@ select cause_player_id, players.player, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join players on activities.cause_player_id = players.player_id
|
left join players on activities.cause_player_id = players.player_id
|
||||||
where action_id = (select action_id from actions where action = 'block-break')
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by cause_player_id, player
|
group by cause_player_id, player
|
||||||
order by count(cause_player_id) desc;
|
order by count(cause_player_id) desc;
|
||||||
|
|
||||||
@@ -83,7 +87,7 @@ select activities.cause_id, causes.cause, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join causes on activities.cause_id = causes.cause_id
|
left join causes on activities.cause_id = causes.cause_id
|
||||||
where action_id = (select action_id from actions where action = 'block-break')
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and activities.cause_player_id is null
|
and activities.cause_player_id is null
|
||||||
group by activities.cause_id, causes.cause
|
group by activities.cause_id, causes.cause
|
||||||
order by count(activities.cause_id) desc;
|
order by count(activities.cause_id) desc;
|
||||||
@@ -93,17 +97,73 @@ select activities.cause_entity_type_id, entity_types.entity_type, count(*)
|
|||||||
from activities
|
from activities
|
||||||
left join entity_types on activities.cause_entity_type_id = entity_types.entity_type_id
|
left join entity_types on activities.cause_entity_type_id = entity_types.entity_type_id
|
||||||
where action_id = (select action_id from actions where action = 'block-break')
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and activities.cause_player_id is null
|
and activities.cause_player_id is null
|
||||||
group by activities.cause_entity_type_id, entity_types.entity_type
|
group by activities.cause_entity_type_id, entity_types.entity_type
|
||||||
order by count(activities.cause_id) desc;
|
order by count(activities.cause_id) desc;
|
||||||
|
|
||||||
|
-- 1天内,活塞破换方块,按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id = (select causes.cause_id from causes where cause = 'piston')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
|
-- 1天内,活塞破换方块,按方块类型分组
|
||||||
|
select blocks.name, count((affected_block_id, blocks.name))
|
||||||
|
from activities
|
||||||
|
left join blocks on activities.affected_block_id = blocks.block_id
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id = (select causes.cause_id from causes where cause = 'piston')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by affected_block_id, blocks.name
|
||||||
|
order by count((affected_block_id, blocks.name)) desc;
|
||||||
|
|
||||||
|
-- 1天内,爆炸破换方块,按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id = (select causes.cause_id from causes where cause = 'explosion')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
|
-- 1天内,爆炸破换方块,按方块类型分组
|
||||||
|
select blocks.name, count((affected_block_id, blocks.name))
|
||||||
|
from activities
|
||||||
|
left join blocks on activities.affected_block_id = blocks.block_id
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id = (select causes.cause_id from causes where cause = 'explosion')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by affected_block_id, blocks.name
|
||||||
|
order by count((affected_block_id, blocks.name)) desc;
|
||||||
|
|
||||||
|
-- 1天内,decay 破换方块,按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id = (select causes.cause_id from causes where cause = 'decay')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
|
-- 1天内,非明确实体触发的block-break行为,按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
|
and cause_id is not null
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
-- 1天内,风弹实体触发的 block-break 行为,按坐标分组
|
-- 1天内,风弹实体触发的 block-break 行为,按坐标分组
|
||||||
select world_id, x, y, z, count((world_id, x, y, z))
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
from activities
|
from activities
|
||||||
where action_id = (select action_id from actions where action = 'block-break')
|
where action_id = (select action_id from actions where action = 'block-break')
|
||||||
and cause_entity_type_id = (select entity_type_id from entity_types where entity_type = 'breeze_wind_charge')
|
and cause_entity_type_id = (select entity_type_id from entity_types where entity_type = 'breeze_wind_charge')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by world_id, x, y, z
|
group by world_id, x, y, z
|
||||||
order by count((world_id, x, y, z)) desc;
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
@@ -115,31 +175,64 @@ where action_id = (select action_id from actions where action = 'block-break')
|
|||||||
and cause_entity_type_id is null
|
and cause_entity_type_id is null
|
||||||
and cause_player_id is null
|
and cause_player_id is null
|
||||||
and cause_id is null
|
and cause_id is null
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
limit 100;
|
limit 100;
|
||||||
|
|
||||||
-- 1天内,发射器的数据,按发射的物品分组统计
|
-- 1天内,item-dispense行为,按发射的物品分组统计
|
||||||
select descriptor, count(*)
|
select descriptor, count(*)
|
||||||
from activities
|
from activities
|
||||||
where action_id = 2
|
where action_id = (select action_id from actions where action = 'item-dispense')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by descriptor
|
group by descriptor
|
||||||
order by count(descriptor) desc;
|
order by count(descriptor) desc;
|
||||||
|
|
||||||
-- 1天内,发射的潜影盒,按坐标分组
|
-- 1天内,item-dispense行为,按坐标分组
|
||||||
select descriptor, count(*)
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
from activities
|
from activities
|
||||||
where action_id = 2
|
where action_id = (select action_id from actions where action = 'item-dispense')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
and descriptor = 'Shulker Box'
|
group by world_id, x, y, z
|
||||||
group by descriptor
|
order by count((world_id, x, y, z)) desc;
|
||||||
order by count(descriptor) desc;
|
|
||||||
|
-- 1天内,item-dispense行为,按坐标与物品分组
|
||||||
|
select world_id, x, y, z, descriptor, count((world_id, x, y, z, descriptor))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'item-dispense')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z, descriptor
|
||||||
|
order by count((world_id, x, y, z, descriptor)) desc;
|
||||||
|
|
||||||
|
-- 1天内,发射的矿车,按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'item-dispense')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
and descriptor = 'Minecart'
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|
||||||
-- 1天内的 entity-death 行为按玩家分组
|
-- 1天内的 entity-death 行为按玩家分组
|
||||||
select cause_player_id, players.player, count(*)
|
select cause_player_id, players.player, count(*)
|
||||||
from activities
|
from activities
|
||||||
left join players on activities.cause_player_id = players.player_id
|
left join players on activities.cause_player_id = players.player_id
|
||||||
where action_id = (select action_id from actions where action = 'entity-death')
|
where action_id = (select action_id from actions where action = 'entity-death')
|
||||||
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
group by cause_player_id, player
|
group by cause_player_id, player
|
||||||
order by count(cause_player_id) desc;
|
order by count(cause_player_id) desc;
|
||||||
|
|
||||||
|
-- 1天内的 entity-death 按实体分组
|
||||||
|
select affected_entity_type_id, entity_types.entity_type, count(*)
|
||||||
|
from activities
|
||||||
|
left join entity_types on activities.affected_entity_type_id = entity_types.entity_type_id
|
||||||
|
where action_id = (select action_id from actions where action = 'entity-death')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by affected_entity_type_id, entity_types.entity_type
|
||||||
|
order by count(*) desc;
|
||||||
|
|
||||||
|
-- 1天内的 block-form 行为按坐标分组
|
||||||
|
select world_id, x, y, z, count((world_id, x, y, z))
|
||||||
|
from activities
|
||||||
|
where action_id = (select action_id from actions where action = 'block-form')
|
||||||
|
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
|
||||||
|
group by world_id, x, y, z
|
||||||
|
order by count((world_id, x, y, z)) desc;
|
||||||
|
|||||||
Reference in New Issue
Block a user