Skip site navigation (1) Skip section navigation (2)

Best possible way to insert and get returned ids

From: Jason Dictos <jdictos(at)barracuda(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Best possible way to insert and get returned ids
Date: 2009-11-23 20:53:10
Message-ID: 65C6A498BB5BF245BD7195255041FA2E0278E9675F@bn-scl-be03.Cudanet.local (view raw or flat)
Thread:
Lists: pgsql-performance
Question:

Is an INSERT command with a SELECT statement in the RETURNING * parameter faster than say an INSERT and then a SELECT? Does the RETURNING * parameter simply amount to a normal SELECT command on the added rows? We need to basically insert a lot of rows as fast as possible, and get the ids that were added.  The number of rows we are inserting is dynamic and is not of fixed length.

Thanks,
-Jason


----------------------------------
Check out the Barracuda Spam & Virus Firewall - offering the fastest
virus & malware protection in the industry: www.barracudanetworks.com/spam

Responses

pgsql-performance by date

Next:From: Bill MoranDate: 2009-11-23 21:05:17
Subject: Re: Strange performance degradation
Previous:From: Lorenzo AllegrucciDate: 2009-11-23 20:46:41
Subject: Re: Strange performance degradation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group