Uncommitted Data

Started by Jonathan Tripathyover 15 years ago3 messagesgeneral
Jump to latest
#1Jonathan Tripathy
jonnyt@abpni.co.uk

Hi Everyone,

What does PG do with data that has been inserted into a table, but was
never committed? Does the data get discarded once the connection dies?

Thanks

#2Joshua D. Drake
jd@commandprompt.com
In reply to: Jonathan Tripathy (#1)
Re: Uncommitted Data

On Wed, 2010-12-08 at 00:56 +0000, Jonathan Tripathy wrote:

Hi Everyone,

What does PG do with data that has been inserted into a table, but was
never committed? Does the data get discarded once the connection dies?

Yes, the transaction will rollback.

Thanks

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

#3Simon Riggs
simon@2ndQuadrant.com
In reply to: Jonathan Tripathy (#1)
Re: Uncommitted Data

On Wed, 2010-12-08 at 00:56 +0000, Jonathan Tripathy wrote:

What does PG do with data that has been inserted into a table, but was
never committed? Does the data get discarded once the connection dies?

The data is there, but is not visible. You can run an explicit VACUUM to
remove the "dead rows", or you can wait for it to be garbage collected
automatically at some point in the future, depending upon your workload.

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services