26 lines
758 B
SQL
26 lines
758 B
SQL
WITH cards AS (
|
|
SELECT id
|
|
FROM tb_iot_card
|
|
WHERE created_at >= '2026-06-10 15:00:28'::timestamp
|
|
AND created_at < '2026-06-10 16:00:00'::timestamp
|
|
),
|
|
task_types(task_type) AS (
|
|
VALUES
|
|
('polling:realname'),
|
|
('polling:carddata'),
|
|
('polling:package'),
|
|
('polling:protect'),
|
|
('polling:card_status')
|
|
)
|
|
SELECT format('ZREM polling:shard:%s:queue:%s %s', id % 16, task_type, id)
|
|
FROM cards CROSS JOIN task_types
|
|
UNION ALL
|
|
SELECT format('DEL polling:card:%s', id)
|
|
FROM cards
|
|
UNION ALL
|
|
SELECT format('LREM polling:manual:%s 0 %s', task_type, id)
|
|
FROM cards CROSS JOIN task_types
|
|
UNION ALL
|
|
SELECT format('SREM polling:manual:dedupe:%s %s', task_type, id)
|
|
FROM cards CROSS JOIN task_types;
|