@@ -151,18 +151,19 @@ function storedCells(scope: ActivityScope, span: InstantRange): SQL {
151151 * The rollup cells of the scope's workspaces that have a pending dirty mark, as
152152 * `(workspace_id, h)`: known to be stale until the mark is processed (or while it backs off after
153153 * failing), so reads take exactly those workspace-hours live and every other workspace's stored
154- * cell for the hour still serves. Read on the mark queue's key, in the read's snapshot.
154+ * cell for the hour still serves. Read on the mark queue's key, in the read's snapshot. Each row is
155+ * a distinct cell: the queue's key is the workspace-hour, and each mark joins one workspace.
155156 */
156157function markedCells ( scope : ActivityScope , span : InstantRange ) : SQL {
157- return sql `SELECT DISTINCT d.workspace_id, d.bucket_start AS h FROM ${ workspace } w
158+ return sql `SELECT d.workspace_id, d.bucket_start AS h FROM ${ workspace } w
158159 JOIN ${ activityRollupDirty } d ON d.workspace_id = w.id
159160 AND d.bucket_start >= ${ utcTimestamp ( span . from ) } AND d.bucket_start < ${ utcTimestamp ( span . to ) }
160161 WHERE w.organization_id = ${ scope . organizationId }
161162 ${ scope . workspaceId ? sql `AND w.id = ${ scope . workspaceId } ` : sql `` } `
162163}
163164
164165/**
165- * Whether the scope has more than {@link MAX_LIVE_MARKED_CELLS} marked cells in `span`, counted
166+ * Whether the scope has more than {@link MAX_LIVE_MARKED_CELLS} marked cells in `span`, reading
166167 * no further than one past the bound.
167168 */
168169async function exceedsLiveMarkedCells (
0 commit comments