We have lots of queries where we only need to change variables( bind parameters) and I was thinking of using prepared statements as it is recommended way for optimize performance to avoid over ahead costs of planning, parsing by query analyzer each time query is executed.
2-phase commit it not recommended. As per postgresql documentations It is unwise to leave transactions in the prepared state for a long time. The intended usage of the feature is that a prepared transaction will normally be committed or rolled back as soon as an external transaction manager has verified that other databases are also prepared to commit. If you have not set up an external transaction manager to track prepared transactions and ensure they get closed out promptly, it is best to keep the prepared-transaction feature disabled. This will prevent accidental creation of prepared transactions that might then be forgotten and eventually cause problems. Although web2py keeps track of such transactions but want to avoid any accidental forgotten transactions e.g. some crash before commit is called in distributed_transaction_commit is called.

