Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visited short URL info to every visit #2275

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Nov 20, 2024

Part of #2180

In order to be able to relate every visit with the short URL that created it, this PR adds a new visitedShortUrl prop to every visit when serialized, which is an object with this type: array{shortCode: string, domain: string|null, shortUrl: string}

@acelaya
Copy link
Member Author

acelaya commented Nov 20, 2024

There's a problem with this PR, because it adds N+1 queries, triggering a SELECT for the short URL and a SELECT for the domain, for every visit.

It could be that some have already been loaded, but I see it adds 10-20% overhead to the visits endpoint, which is already relatively slow.

It is probably better to build a more efficient query which loads visit, visit location, and potentially short URL and domain data beforehand, and check if that's more efficient.

@acelaya acelaya force-pushed the feature/visited-short-url branch from 103f5a1 to a9f1c93 Compare November 22, 2024 08:17
@acelaya acelaya force-pushed the feature/visited-short-url branch from a9f1c93 to 5d6abe5 Compare December 12, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant