Обсуждение: Transaction costs?
Just wondering what the cost of begin/end transaction is. This is for pg_dump which, when restoring BLOBs, inserts multiple rows into a temporary xref table. The sequence of events is: Conn1: Begin Conn1: lo_create/lo_close/lo_write.../lo_close Conn2: Insert into xref table (which does an implicit begin/end, I think). Conn1: Commit; Would I get substantially better performance by doing a begin/end every 10/100/1000 rows in each connection, or is the transaction overhead low? Or is this something I just need to test? [eg. in Dec/RDB TX begin/end is expensive, but writing more than 1000 rows in a TX can also be costly, so a compromise is useful] ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
Philip Warner <pjw@rhyme.com.au> writes: > This is for pg_dump which, when restoring BLOBs, inserts multiple rows into > a temporary xref table. The sequence of events is: > Conn1: Begin > Conn1: lo_create/lo_close/lo_write.../lo_close > Conn2: Insert into xref table (which does an implicit begin/end, I think). > Conn1: Commit; Two connections? Why in the world are you doing it like that --- and especially in that order? Seems like this is committing an xref change before the LO itself is committed. Why? regards, tom lane
At 11:33 2/11/00 -0500, Tom Lane wrote: >> Conn1: Begin >> Conn1: lo_create/lo_close/lo_write.../lo_close >> Conn2: Insert into xref table (which does an implicit begin/end, I think). >> Conn1: Commit; > >Two connections? Otherwise a reconnect will lose the temp table contents. ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/