Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Possibility to set if the transaction is read only or not #6818

Open
Crovitche-1623 opened this issue Mar 3, 2025 · 0 comments
Open

Comments

@Crovitche-1623
Copy link

Feature Request

What

On many RDBMS, it's possible to specify if the transaction is read only or not (READ WRITE). By default, a transaction is READ WRITE. When a transaction is set to READ ONLY, it prevent any modification during the transaction and can improve performance in certain cases.

Moreover, I think this READ ONLY / READ WRITE flag is supported by most platforms:

Why

  1. It can improve performance in certain circumstances. E.g. when SERIALIZABLE TRANSACTIONS are used. See https://www.postgresql.org/docs/current/transaction-iso.html
  2. It can improve security in some ways by specifying that no modifications are expected during the transaction.

How

Maybe add a readOnly parameter to the getSetTransactionIsolationSQLmethod with false as the default value:

abstract public function getSetTransactionIsolationSQL(TransactionIsolationLevel $level, bool $readOnly = false): string;

and use this value later to conditionally add READ WRITE or READ ONLY to the statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant