From 31f786a11299cdf29a42d925e58fd341f8bbe5c2 Mon Sep 17 00:00:00 2001 From: Fortern Date: Fri, 5 Dec 2025 01:34:52 +0800 Subject: [PATCH] prism --- PostgreSQL/prism/prism.sql | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/PostgreSQL/prism/prism.sql b/PostgreSQL/prism/prism.sql index 50c46bc..dde2908 100644 --- a/PostgreSQL/prism/prism.sql +++ b/PostgreSQL/prism/prism.sql @@ -38,7 +38,7 @@ group by cause_entity_type_id, entity_type order by count(cause_entity_type_id) desc; -- 1天内,非明确实体触发的block-place行为,按cause_id分组 -select activities.cause_id, causes.cause, count(activities.cause_id) +select activities.cause_id, causes.cause, count(*) from activities left join causes on activities.cause_id = causes.cause_id where action_id = (select action_id from actions where action = 'block-place') @@ -55,3 +55,40 @@ where action_id = (select action_id from actions where action = 'block-place') 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; + +-- 1天内,unknown 引发的 block-place 事件,按坐标分组并排序 +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-place') + and cause_id = (select cause_id from causes where cause = 'unknown') + 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; + +-- 1天内的 block-break 行为按玩家分组 +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 = 'block-break') + and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 +group by cause_player_id, player +order by count(cause_player_id) desc; + +-- 1天内,非玩家触发的 block-break 行为,按 cause_id 分组 +select activities.cause_id, causes.cause, count(*) +from activities + left join causes on activities.cause_id = causes.cause_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_id, causes.cause +order by count(activities.cause_id) 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_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 +group by world_id, x, y, z +order by count((world_id, x, y, z)) desc;