pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Autocommit
4+ messages / 2 participants
[nested] [flat]

* Autocommit
@ 2005-02-14 08:01 Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
  2005-02-14 08:47 ` Re: Autocommit Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Hasnul Fadhly bin Hasan @ 2005-02-14 08:01 UTC (permalink / raw)
  To: pgsql-performance

Hi,

I am just wondering, by default, autocommit is enabled for every client 
connection.  The documentations states that we have to use BEGIN
and  END or COMMIT so to increase performance by not using autocommit. 
My question is, when we use the BEGIN and END statements, is autocommit 
unset/disabled automatically or we have to disable/unset it manually?


Hasnul





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Autocommit
  2005-02-14 08:01 Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
@ 2005-02-14 08:47 ` Michael Fuhr <mike@fuhr.org>
  2005-02-14 08:58   ` Re: Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
  0 siblings, 1 reply; 4+ messages in thread

From: Michael Fuhr @ 2005-02-14 08:47 UTC (permalink / raw)
  To: Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>; +Cc: pgsql-performance

On Mon, Feb 14, 2005 at 04:01:20PM +0800, Hasnul Fadhly bin Hasan wrote:
> 
> I am just wondering, by default, autocommit is enabled for every client 
> connection.  The documentations states that we have to use BEGIN
> and  END or COMMIT so to increase performance by not using autocommit. 
> My question is, when we use the BEGIN and END statements, is autocommit 
> unset/disabled automatically or we have to disable/unset it manually?

What version of PostgreSQL is your server running and what client
software are you using?  PostgreSQL 7.3 had a server-side autocommit
setting, but it caused problems with some clients so 7.4 got rid
of it and left autocommit up to the client.  How to enable or disable
client-side autocommit depends on the client software, but if you're
able to execute a BEGIN (or START TRANSACTION) statement then you
should be inside a transaction until you execute COMMIT (or END)
or ROLLBACK.  That is, unless your client intercepts these statements
and does whatever it wants....

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Autocommit
  2005-02-14 08:01 Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
  2005-02-14 08:47 ` Re: Autocommit Michael Fuhr <mike@fuhr.org>
@ 2005-02-14 08:58   ` Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
  2005-02-14 09:34     ` Re: Autocommit Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Hasnul Fadhly bin Hasan @ 2005-02-14 08:58 UTC (permalink / raw)
  To: Michael Fuhr <mike@fuhr.org>; +Cc: pgsql-performance

Hi Micheal,

Thanks for the reply.  I am using postgres 7.4.5 client.  There's one 
that is using 7.4.1 client.  I'm not sure if there would be any difference.
When i use psql and check the status of autocommit, it is set to 
enable.  I'm not sure if libpq and psql uses the same defaults.

Thanks,

Hasnul



Michael Fuhr wrote:

>On Mon, Feb 14, 2005 at 04:01:20PM +0800, Hasnul Fadhly bin Hasan wrote:
>  
>
>>I am just wondering, by default, autocommit is enabled for every client 
>>connection.  The documentations states that we have to use BEGIN
>>and  END or COMMIT so to increase performance by not using autocommit. 
>>My question is, when we use the BEGIN and END statements, is autocommit 
>>unset/disabled automatically or we have to disable/unset it manually?
>>    
>>
>
>What version of PostgreSQL is your server running and what client
>software are you using?  PostgreSQL 7.3 had a server-side autocommit
>setting, but it caused problems with some clients so 7.4 got rid
>of it and left autocommit up to the client.  How to enable or disable
>client-side autocommit depends on the client software, but if you're
>able to execute a BEGIN (or START TRANSACTION) statement then you
>should be inside a transaction until you execute COMMIT (or END)
>or ROLLBACK.  That is, unless your client intercepts these statements
>and does whatever it wants....
>
>  
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Autocommit
  2005-02-14 08:01 Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
  2005-02-14 08:47 ` Re: Autocommit Michael Fuhr <mike@fuhr.org>
  2005-02-14 08:58   ` Re: Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
@ 2005-02-14 09:34     ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Fuhr @ 2005-02-14 09:34 UTC (permalink / raw)
  To: Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>; +Cc: pgsql-performance

On Mon, Feb 14, 2005 at 04:58:31PM +0800, Hasnul Fadhly bin Hasan wrote:

> Thanks for the reply.  I am using postgres 7.4.5 client.  There's one 
> that is using 7.4.1 client.  I'm not sure if there would be any difference.
> When i use psql and check the status of autocommit, it is set to 
> enable.  I'm not sure if libpq and psql uses the same defaults.

As far as I can tell, libpq doesn't have an autocommit setting --
it just sends statements on behalf of the application.  Clients
that allow the user to disable autocommit presumably do so by
implicitly sending BEGIN statements to start new transactions.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-02-14 09:34 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 08:01 Autocommit Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
2005-02-14 08:47 ` Michael Fuhr <mike@fuhr.org>
2005-02-14 08:58   ` Hasnul Fadhly bin Hasan <hasnulfadhly.h@mimos.my>
2005-02-14 09:34     ` Michael Fuhr <mike@fuhr.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox