Question about SNAPSHOT isolation level


I have a question about SNAPSHOT isolation level.

I’m trying to “update” an object.

So I run a query to delete every statement for a subject and insert the new statements. Like this:

delete {graph ?g {?a ?b ?c}}
insert {graph ?g {
<> <> <> .
<> <> "2018-03-09T11:33:51.000+01:00"^^<> .
<> <> "false"^^<> .
<> <> "2017-12-09T11:33:52.136+01:00"^^<> .
<> <> "1090766619" .
<> <> "2017-12-09T11:33:51.520+01:00"^^<> .
<> <> "-406465849" .
<> <tag:complexible:pinto:brukerType> "" .
<> <> "a" .
<> <> "0"^^<> .
<> <> "$2a$10$Rk0AwsnZYy30hRkKvEhVYO88M8dymkMVBNWfdC4oLEA5s0sCC43Y2" .
}} where {graph ?g {BIND(<> as ?a) ?a ?b ?c}}

If I run these queries on parallel for the same user, I end up getting duplicate statements. eg: (see millis on timestamp)

<> <> "2017-12-09T11:33:52.136+01:00"^^<> .
<> <> "2017-12-09T11:33:52.145+01:00"^^<> .

I guess this is because I’m using SNAPSHOT isolation and not SERIALIZABLE. When I switch to SERIALIZABLE I never get duplicates.

Is there a way to achieve what I’m trying to do without switching over to SERIALIZABLE?


Hi Håvard,

SERIALIZABLE exists specifically to deal with the issue you bring up here, so unfortunately there is no way to achieve this with SNAPSHOT

Ok. Thanks Stephen.

I’ll have to do some benchmarks then to see how it impacts performance.

Would be great to have subject-level locking as a new isolation level between SERIALIZABLE and SNAPSHOT.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.