Search Postgresql Archives

Transaction question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux