UPDATE_ACTIVITY_BIT

All functions > BUSINESS > UPDATE_ACTIVITY_BIT

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

Signatures

Returns: Updated activity bits with today's activity

UPDATE_ACTIVITY_BIT(activity_bits: BIGINT, is_active: BOOLEAN) → BIGINT
sql
ParameterTypeRequiredDescription
activity_bitsBIGINTYesCurrent bit-packed activity representation
is_activeBOOLEANYesWhether user was active today

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: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19