Settings

Theme

Hydra (YC W22) adds upsert to columnar Postgres

github.com

1 points by coatue 2 years ago · 1 comment

Reader

coatueOP 2 years ago

Upsert, also known as "INSERT ... ON CONFLICT", is a feature in PostgreSQL that let's a user insert a new record or update an existing one if it already exists, using a single command.

Upsert is useful in several ways:

1. Data Consistency: It manages and keeps the data clean and free of redundancies. Any attempt to insert a new row of data into an existing table is modified into update commands when a conflict occurs.

2. Simplified Queries: Instead of writing separate INSERT and UPDATE queries, with Upsert, you can both cases in a single query thereby reducing the complexity.

3. Efficiency: Since a single statement can handle the process of inserting a new row or updating an existing one, the number of queries processed by the server can be reduced.

4. Atomicity: Upsert operations are atomic, meaning they will either fully complete or fully fail, ensuring the data integrity is maintained.

5. Error Handling: It prevents the processing from being halted due to error thrown if data already exists. In a large batch operation, this is especially useful.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection