Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Conversation

@cevian
Copy link
Contributor

@cevian cevian commented Oct 14, 2022

This commit changes the order of operations from:
COPY to temp_metric1
INSERT from temp_metric_1 to metric_1 ON CONFLICT DO NOTHING COPY to temp_metric2
INSERT from temp_metric_2 to metric_2 ON CONFLICT DO NOTHING

to

COPY to temp_metric1
COPY to temp_metric2
INSERT from temp_metric_1 to metric_1 ON CONFLICT DO NOTHING INSERT from temp_metric_2 to metric_2 ON CONFLICT DO NOTHING

By combining the inserts together at the end of the transaction it decreases the times that locks on conflicting rows are held.

Description

Merge requirements

Please take into account the following non-code changes that you may need to make with your PR:

  • CHANGELOG entry for user-facing changes
  • Updated the relevant documentation

This commit changes the order of operations from:
COPY to temp_metric1
INSERT from temp_metric_1 to metric_1 ON CONFLICT DO NOTHING
COPY to temp_metric2
INSERT from temp_metric_2 to metric_2 ON CONFLICT DO NOTHING

to

COPY to temp_metric1
COPY to temp_metric2
INSERT from temp_metric_1 to metric_1 ON CONFLICT DO NOTHING
INSERT from temp_metric_2 to metric_2 ON CONFLICT DO NOTHING

By combining the inserts together at the end of the transaction
it decreases the times that locks on conflicting rows are held.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants