This commit is contained in:
2025-12-08 13:44:20 +08:00
parent 31f786a112
commit 81ec6dc819

View File

@@ -2,6 +2,10 @@
select max(timestamp)
from activities;
-- 获取最旧的数据
select min(timestamp)
from activities;
-- 1天内的数据按action分组排序
select b.action_id, b.action, count(b.action_id)
from activities as a
@@ -84,6 +88,16 @@ where action_id = (select action_id from actions where action = 'block-break')
group by activities.cause_id, causes.cause
order by count(activities.cause_id) desc;
-- 1天内非玩家触发的 block-break 行为,按 type_id 分组
select activities.cause_entity_type_id, entity_types.entity_type, count(*)
from activities
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')
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
and activities.cause_player_id is null
group by activities.cause_entity_type_id, entity_types.entity_type
order by count(activities.cause_id) desc;
-- 1天内风弹实体触发的 block-break 行为,按坐标分组
select world_id, x, y, z, count((world_id, x, y, z))
from activities
@@ -92,3 +106,40 @@ where action_id = (select action_id from actions where action = 'block-break')
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
group by world_id, x, y, z
order by count((world_id, x, y, z)) desc;
-- 查看最近风弹破换方块的数据
select *
from activities
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 is null
and cause_player_id is null
and cause_id is null
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
limit 100;
-- 1天内发射器的数据按发射的物品分组统计
select descriptor, count(*)
from activities
where action_id = 2
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
group by descriptor
order by count(descriptor) desc;
-- 1天内发射的潜影盒按坐标分组
select descriptor, count(*)
from activities
where action_id = 2
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
and descriptor = 'Shulker Box'
group by descriptor
order by count(descriptor) desc;
-- 1天内的 entity-death 行为按玩家分组
select cause_player_id, players.player, count(*)
from activities
left join players on activities.cause_player_id = players.player_id
where action_id = (select action_id from actions where action = 'entity-death')
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
group by cause_player_id, player
order by count(cause_player_id) desc;