Re: about transactions in Postgresql

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

 





I think the question you need to ask yourself, is "Is it worth it?". Meaning, is there a strong need to have a transactional based subscription? If there is, then by all means go for it, otherwise, you may want to look into other ways of ensure that your inserts are successful or having the appropriate error handling when they fail.

Jordan

Raphael Hamzagic de Carvalho wrote:

Hi,

I dont know if transactions decrease considerable performance in register
systems.
For Example:

PHP algoritm:

$query = "Begin;";
pg_query($connId, $query);

$query = "insert into member values('Jim Jones', '21', 'passw',
'jim@bfr.com');";
pg_query($connId, $query);

if ( mail(jim@bfr.com, "Welcome", "", ""))
{
   $query = "COMMIT;";
   pg_query($connId, $query);
}
else
{
   $query = "ROLLBACK;";
   pg_query($connId, $query);
}



I dont know if this is a good technique, but my point is:
If the email that is sent to the user being inserted on database fails, I
want to rollback transaction and dont register that user....

Thanks in advance!

Rapha








--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux