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

Remove unnecessary Upsert #2348

Open
Ayiga opened this issue Dec 3, 2024 · 0 comments
Open

Remove unnecessary Upsert #2348

Ayiga opened this issue Dec 3, 2024 · 0 comments

Comments

@Ayiga
Copy link
Member

Ayiga commented Dec 3, 2024

The Upsert provided by this statement:

INSERT INTO highest_voted_view (id, view) VALUES (0, $1)
ON CONFLICT (id) DO UPDATE SET view = GREATEST(highest_voted_view.view, excluded.view)";
seems unnecessary.

From the logic itself, it looks like it will try to insert a record for id 0, and on conflict it changes it to an update itself.

This implies that the first time this is run, a single row will be inserted, and for ALL other invocations will result in an update instead. So it seems like we could instead just change this to an update, and populate an initial record in a migration script itself.

It's unclear how much of an impact this might have, if any, but it could still be simplified none-the-less.

@Ayiga Ayiga added the sequencer label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant