UPDATE_ACTIVITY_BIT

All functions > BUSINESS_ACTIVITY > UPDATE_ACTIVITY_BIT

Returns the activity bits for the given activity bits and whether the current day is active.

Syntax

UPDATE_ACTIVITY_BIT(activity_bits: BIGINT, is_active: BOOLEAN) → BIGINT
sql

Arguments

ParameterTypeRequiredDescription
activity_bitsBIGINTYesCurrent bit-packed activity representation
is_activeBOOLEANYesWhether user was active today

Returns

BIGINT - Updated activity bits with today's activity

Notes

  • Updates activity bits for current day (shifts left and adds new bit)
  • Shifts all bits left by 1 position (aging the data)
  • Sets bit 0 based on is_active parameter
  • Preserves the "active before" flag in bit 56
  • Used for incremental daily activity tracking
  • Maintains sliding 56-day window
  • Efficiently updates without reconstructing from dates
Last update at: 2025/10/13 10:23:46