You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/client-libraries/python.mdx
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -326,6 +326,8 @@ client.execute_query(node)
326
326
```
327
327
328
328
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.
329
331
330
332
#### Run a read query
331
333
@@ -342,6 +344,8 @@ for record in records:
342
344
```
343
345
344
346
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.
345
349
346
350
#### Running queries with property map
347
351
@@ -545,6 +549,8 @@ With sessions, you can run:
545
549
##### Managed transactions
546
550
547
551
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
+
548
554
549
555
```python
550
556
defmatch_user(tx, name):
@@ -581,6 +587,12 @@ To maintain multiple concurrent transactions, use [multiple concurrent sessions]
581
587
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.
582
588
Explicit transactions offer the possibility of explicitly controlling the end of a transaction with `Transaction.commit()`, `Transaction.rollback()` or `Transaction.close()` methods.
583
589
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
+
584
596
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**.
585
597
586
598
The following example shows how to explicitly control the transaction of changing account balances based on a token transfer:
Copy file name to clipboardExpand all lines: pages/help-center/errors/transactions.mdx
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -119,15 +119,17 @@ Here are the [instructions](/configuration/configuration-settings#using-flags-an
119
119
120
120
Here are the storage access error messages you might encounter:
121
121
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.**
123
123
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.**
124
125
125
126
### Understanding storage access timeout
126
127
127
128
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:
128
129
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.
130
131
-**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.
131
133
132
134
These timeouts prevent worker starvation and database blocking that could occur if queries were to wait indefinitely for storage access.
0 commit comments