sandy-bes commented on code in PR #2351:
URL: https://github.com/apache/age/pull/2351#discussion_r3013700953
##########
src/backend/executor/cypher_utils.c:
##########
@@ -238,20 +240,47 @@ bool entity_exists(EState *estate, Oid graph_oid, graphid
id)
GetCurrentCommandId(false));
rel = table_open(label->relation, RowExclusiveLock);
- scan_desc = table_beginscan(rel, estate->es_snapshot, 1, scan_keys);
- tuple = heap_getnext(scan_desc, ForwardScanDirection);
+ index_oid = find_usable_index_for_attr(rel, 1);
- /*
- * If a single tuple was returned, the tuple is still valid, otherwise'
- * set to false.
- */
- if (!HeapTupleIsValid(tuple))
+ if (OidIsValid(index_oid))
{
- result = false;
+ IndexScanDesc index_scan_desc;
+ Relation index_rel;
+
+ slot = table_slot_create(rel, NULL);
+
+ index_rel = index_open(index_oid, RowExclusiveLock);
Review Comment:
I originally matched the table's lock level due to the upstream modification
paths (create_vertex, etc.), but I see now why AccessShareLock is the correct
(and much more concurrent) choice for the index scan itself. Fixed in the
latest commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]