pg.ddx.io pgsql-jdbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
help lock record 4+ messages / 2 participants [nested] [flat]
* help lock record @ 2006-05-23 17:37 bitrunner <bitrunner@katamail.com> 0 siblings, 1 reply; 4+ messages in thread From: bitrunner @ 2006-05-23 17:37 UTC (permalink / raw) To: pgsql-jdbc For lock the record I use: select * from orders where id = 17 for update in this way lock the record with id = 17. If an other user demands the same record as I can understand that it is lock? Thanks a lot. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: help lock record @ 2006-05-23 18:40 Dave Cramer <pg@fastcrypt.com> parent: bitrunner <bitrunner@katamail.com> 0 siblings, 0 replies; 4+ messages in thread From: Dave Cramer @ 2006-05-23 18:40 UTC (permalink / raw) To: bitrunner <bitrunner@katamail.com>; +Cc: pgsql-jdbc On 23-May-06, at 1:37 PM, bitrunner wrote: > For lock the record I use: > select * from orders where id = 17 for update > > in this way lock the record with id = 17. > If an other user demands the same record as I can understand that > it is lock? yes as long as autocommit is false this is true. In other words as long as you do this inside a transaction/ > > Thanks a lot. > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: help lock record @ 2006-05-24 12:49 bitrunner <bitrunner@katamail.com> 0 siblings, 1 reply; 4+ messages in thread From: bitrunner @ 2006-05-24 12:49 UTC (permalink / raw) To: pgsql-jdbc >> I must set up of the parameters to postgresql.conf? > Yes, you must set this in postgresql.conf Excuse but this is the parameter that I must set up? thanks a lot. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: help lock record @ 2006-05-24 13:01 Dave Cramer <pg@fastcrypt.com> parent: bitrunner <bitrunner@katamail.com> 0 siblings, 0 replies; 4+ messages in thread From: Dave Cramer @ 2006-05-24 13:01 UTC (permalink / raw) To: bitrunner <bitrunner@katamail.com>; +Cc: pgsql-jdbc On 24-May-06, at 8:49 AM, bitrunner wrote: > >> I must set up of the parameters to postgresql.conf? > > > Yes, you must set this in postgresql.conf > > Excuse but this is the parameter that I must set up? Yes, but be aware, this is not an optimal solution. All kinds of statements will time out on this. For instance if you set this to 1000ms then try to do a vacuum it will likely timeout. However you can use the set command from java on the connection to set the timeout per connection con = Database.getConnection() stmt = con.getStatement stmt.execute("set statement_timeout=1000"); do your locking code con.close() Dave > > thanks a lot. > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-05-24 13:01 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2006-05-23 17:37 help lock record bitrunner <bitrunner@katamail.com> 2006-05-23 18:40 ` Dave Cramer <pg@fastcrypt.com> 2006-05-24 12:49 Re: help lock record bitrunner <bitrunner@katamail.com> 2006-05-24 13:01 ` Dave Cramer <pg@fastcrypt.com>
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