Queries and performance

Return changed rows

Use RETURNING to get generated or updated values without sending a second query.

8 minute lesson

~~~

PostgreSQL can return values directly from an insert, update, or delete:

INSERT INTO notes (title)
VALUES ('Plan the week')
RETURNING id, title;

This keeps the change and its result in one statement.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →