Compare commits

..

12 Commits

Author SHA1 Message Date
0eb8ecf506 prism 2026-01-28 06:32:31 +08:00
c434145fa1 prism 2026-01-28 05:59:46 +08:00
099266cd64 prism 2026-01-28 04:09:32 +08:00
ad1287d947 prism 2026-01-28 03:58:05 +08:00
fe694579f1 prism 2026-01-22 21:44:55 +08:00
7dbc3aefde prism 2026-01-22 21:39:46 +08:00
612612b37a prism 2026-01-04 17:32:19 +08:00
f5b352c036 prism 2026-01-04 17:16:22 +08:00
362ef3489b prism 2026-01-04 17:01:04 +08:00
b9829f374a prism 2026-01-04 16:42:45 +08:00
3e209b2243 prism 2026-01-04 16:23:24 +08:00
5e6a0e9b2f prism 2026-01-04 16:03:09 +08:00

View File

@@ -1,9 +1,13 @@
-- 获取最新的数据
select to_timestamp(max(timestamp))
-- 获取最旧于最新的数据
select to_timestamp(min(timestamp)) as min, to_timestamp(max(timestamp)) as max
from activities;
-- 获取最旧的数据
select to_timestamp(min(timestamp))
-- 最大与最小id
select min(activity_id), max(activity_id)
from activities;
-- 数据总量
select max(activity_id) - min(activity_id) + 1
from activities;
-- 1天内的数据按action分组排序
@@ -98,6 +102,53 @@ where action_id = (select action_id from actions where action = 'block-break')
group by activities.cause_entity_type_id, entity_types.entity_type
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
@@ -127,22 +178,38 @@ where action_id = (select action_id from actions where action = 'block-break')
and timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400 * 1
limit 100;
-- 1天内发射器的数据,按发射的物品分组统计
-- 1天内item-dispense行为,按发射的物品分组统计
select descriptor, count(*)
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 * 1
group by descriptor
order by count(descriptor) desc;
-- 1天内发射的潜影盒,按坐标分组
select descriptor, count(*)
-- 1天内item-dispense行为,按坐标分组
select world_id, x, y, z, count((world_id, x, y, z))
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 * 1
and descriptor = 'Shulker Box'
group by descriptor
order by count(descriptor) desc;
group by world_id, x, y, z
order by count((world_id, x, y, z)) 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 行为按玩家分组
select cause_player_id, players.player, count(*)
@@ -161,3 +228,11 @@ 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;