Transaction question

From: Dragan Zubac <zubac(at)vlayko(dot)tv>
To: pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: Transaction question
Date: 2007-11-23 11:31:59
Message-ID: 4746BA2F.6030104@vlayko.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2007-11-23 11:49:04 Re: Primary Key
Previous Message Csaba Nagy 2007-11-23 11:00:18 Re: Primary Key

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2007-11-23 12:21:32 Re: 8.3beta3: Compile Warnings
Previous Message Alvaro Herrera 2007-11-23 11:10:37 Re: [HACKERS] wrong behavior using to_char() again