Skip to content

Commit

Permalink
Improve find-existing-acitivty query in data-sink-worker
Browse files Browse the repository at this point in the history
This change makes it use:

    CREATE UNIQUE INDEX activities_tenant_segment_source_id_idx
    ON activities ("tenantId", "segmentId", "sourceId")
    WHERE ("deletedAt" IS NULL);

instead of:

    CREATE UNIQUE INDEX ix_unique_activities_tenantid_platform_type_sourceid_segmentid
    ON activities ("tenantId", platform, type, "sourceId", "segmentId");
  • Loading branch information
Misha Savelyev committed Jan 10, 2024
1 parent 46abde5 commit 5b50777
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions services/apps/data_sink_worker/src/repo/activity.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default class ActivityRepository extends RepositoryBase<ActivityRepositor
and "segmentId" = $(segmentId)
and "sourceId" = $(sourceId)
and channel = $(channel)
and "deletedAt" IS NULL
limit 1;
`,
{
Expand Down

0 comments on commit 5b50777

Please sign in to comment.