Transaction question - Mailing list pgsql-general

From Dragan Zubac
Subject Transaction question
Date
Msg-id 4746BA2F.6030104@vlayko.tv
Whole thread Raw
Responses Re: [HACKERS] Transaction question  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-general
Hello all

Didn't know where to submit question regarding design&performance.
Here's the situation.
Basically process will take one message at a time,send it and the will
send another one,each process knows which message to take from the table
based on provider value.

First situation:

table layout:

id bigint
user int
provider int

Begin transaction,take one message from the table,send it,if all went
well,then commit.The drawback of this situation is that transaction can
last much longer depending how much time it will take to send message
and confirm it was sent based on protocol used.

Second situation:

table layout:


id bigint
user int
provider int
taken boolean
sent boolean
false boolean

In this scenario the process will take one message from the table,and
mark it as 'taken',meaning it is taken for processing.The process will
try to send message,if it succeed,it will update column 'sent',otherwise
it will update column 'false'. In this scenario ,we'd have two instead
of one transaction but each of this transaction will last much less then
in first scenario,hence we might be able to achieve greater TPS then in
first case.

Hope You got my point,maybe somebody already had the same/similar
situation ?

Sincerely

Dragan Zubac


pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: Primary Key
Next
From: Sam Mason
Date:
Subject: Re: Primary Key