Skip to content

Commit f704450

Browse files
committed
wip
1 parent bed635a commit f704450

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pages/client-libraries/python.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ client.execute_query(node)
326326
```
327327

328328
Due to the nature of the `execute_query()` method, transactions are handled automatically.
329+
As of Memgraph version 3.2, queries are categorized as read/write and corresponding storage access given. This allows for better query parallelization and higher throughput.
330+
Single query execution does not need to be explicitly marked by the user. The query is analyzed and the access type determined.
329331

330332
#### Run a read query
331333

@@ -342,6 +344,8 @@ for record in records:
342344
```
343345

344346
In this query, each record contains a node object behind the variable `n`.
347+
As of Memgraph version 3.2, queries are categorized as read/write and corresponding storage access given. This allows for better query parallelization and higher throughput.
348+
Single query execution does not need to be explicitly marked by the user. The query is analyzed and the access type determined.
345349

346350
#### Running queries with property map
347351

@@ -545,6 +549,8 @@ With sessions, you can run:
545549
##### Managed transactions
546550

547551
To create a managed transaction, use `Session.execute_read()` procedure for read queries and `Session.execute_write()` procedure for write queries.
552+
As of Memgraph version 3.2, queries are categorized as read/write and corresponding storage access given. This allows for better query parallelization and higher throughput.
553+
548554

549555
```python
550556
def match_user(tx, name):
@@ -581,6 +587,12 @@ To maintain multiple concurrent transactions, use [multiple concurrent sessions]
581587
With explicit transactions, you can get **complete control over transactions**. To begin a transaction, run `Session.begin_transaction()` procedure and to run a transaction, use `Transaction.run()` procedure.
582588
Explicit transactions offer the possibility of explicitly controlling the end of a transaction with `Transaction.commit()`, `Transaction.rollback()` or `Transaction.close()` methods.
583589

590+
As of Memgraph version 3.2, queries are categorized as read/write and corresponding storage access given. This allows for better query parallelization and higher throughput.
591+
Explicit transactions cover a number of individual queries, but storage access is given at the start. For best performance, the user needs to declare whether the transaction should use read or write access.
592+
This can be done by:
593+
1. calling `begin_transaction(mode="r"/"w")`, here `mode` explicitly defines whether the transaction should take a read ("r") or write ("w") access
594+
1. using `read_transaction()` or `write_transaction()` in place of `begin_transaction()`
595+
584596
Use explicit transaction if you need to **distribute Cypher execution across multiple functions for the same transaction** or if you need to **run multiple queries within a single transactions without automatic retries**.
585597

586598
The following example shows how to explicitly control the transaction of changing account balances based on a token transfer:

pages/help-center/errors/transactions.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,17 @@ Here are the [instructions](/configuration/configuration-settings#using-flags-an
119119

120120
Here are the storage access error messages you might encounter:
121121

122-
1. **Cannot access storage, unique access query is running. Try again later.**
122+
1. **Cannot get shared access storage. Try stopping other queries that are running in parallel.**
123123
2. **Cannot get unique access to the storage. Try stopping other queries that are running in parallel.**
124+
3. **Cannot get read only access to the storage. Try stopping other queries that are running in parallel.**
124125

125126
### Understanding storage access timeout
126127

127128
Storage access timeouts occur during query preparation when the query execution engine cannot get the required type of access to the storage. There are two types of storage access:
128129

129-
- **Shared access**: Multiple queries can have shared access at the same time, but shared access cannot be granted while a query with unique access is running.
130+
- **Shared access**: Multiple queries can have shared access at the same time. These queries are marked with a read or write type, allowing Memgraph to efficiently execute multiple operations in parallel without conflicts, as long as no unique access is required.
130131
- **Unique access**: Only one query can have unique access at a time, and no other query can have any type of access during that period.
132+
- **Read-only access**: Queries with read-only access allow other read queries to run in parallel but forbid any write operations or queries requiring unique access.
131133

132134
These timeouts prevent worker starvation and database blocking that could occur if queries were to wait indefinitely for storage access.
133135

0 commit comments

Comments
 (0)